OK, I’m in the middle of making my game and I have the following screens:
-Main Menu
-Settings
-Level Select
-Level 1
In the main.lua file I have the following function to monitor the memory and texture memory in use:
[lua]local monitorMem = function()
collectgarbage(“collect”)
print( "\nMemUsage: " … collectgarbage(“count”) )
local textMem = system.getInfo( “textureMemoryUsed” ) / 1000000
print( "TexMem: " … textMem )
end
local memTimer = timer.performWithDelay(1000, monitorMem, -1)[/lua]
I’m trying to work out if and where I’m leaking memory and need some advice please. I’ve being pulling my hair out over this for a few days now trying to figure all this out.
When I open the main.lua Igo straight to the Main Menu and here’s the output:
MemUsage: 236.72265625
TexMem: 2.686976
If I go to the Level Select screen from here, this is the new output:
MemUsage: 269.76171875
TexMem: 3.227648
Now, if I return to the Main Menu from here:
MemUsage: 249.0576171875
TexMem: 2.686976
The texture memory returns back to the initial starting point (good), but personally, I would have expected the memory usage to return to the initial level but it has gained 13 (is this Kb?).
Does this signify a memory leak? What exactly is the MemUsage and what happens if it climbs? Is Texture Memory more important?
Continuing on…from the Main Menu I go back to Level Select:
MemUsage: 275.8671875
TexMem: 3.227648
Then on to Level 1:
MemUsage: 287.41015625
TexMem: 2.613248
Back to the Main Menu:
MemUsage: 285.908203125
TexMem: 2.686976
Please can someone throw some light on this…
[import]uid: 74503 topic_id: 18063 reply_id: 318063[/import]