Does anyone have experience of multiplayer coding using gamesparks realtime? I’ve been searching through my code to find the source of a memory leak and narrowed it down to where the real time data is sent. I’ve included some code from a test scene created to demonstrate the problem.
local function onEnterFrame() SESSION.session:update() local data = RTdata.new() -- set some random data to be sent for i = 1, 96 do data:setLong( i, rand( 1, 10000 ) ) end data:setString( 50, "Test 123" ) -- commenting out the next line removes the memory leak SESSION.session:sendRTData( 10, GSRT.deliveryIntent.UNRELIABLE, data, {} ) end
The system memory increases steadily, first slowing things down and then grinding the device to a halt. Building the data packet to be sent, but removing the line of code that actually sends it fixes the problem. There may be a command I’m not aware of that clears down session data after it is sent, but I’ve not been able to find anything. I did find the RTData:dispose() method which clears down the RTData slots after using setLong, setString, etc., but it didn’t make any difference.
Any ideas or insights appreciated!