I have an immensely complicated object…an entire graphic book…which I am trying to delete. It is a display group, with many new functions and values attached to it.
When I try to delete it, using something like
mybook:removeSelf()
mybook = nil
the object goes away and becomes nil, but when I check memory, the memory does not decrease. I am using the memory code provided in the entry about finding and solving memory leaks:
https://developer.coronalabs.com/forum/2012/05/21/guide-findingsolving-memory-leaks
Here’s the memory reporting code:
local prevTextMem = 0
local prevMemCount = 0
local monitorMem = function()
collectgarbage()
local memCount = collectgarbage("count")
if (prevMemCount ~= memCount) then
print( "MemUsage: " .. memCount)
prevMemCount = memCount
end
local textMem = system.getInfo( "textureMemoryUsed" ) / 1000000
if (false and prevTextMem ~= textMem) then
prevTextMem = textMem
print( "TexMem: " .. textMem )
end
io.flush()
end
The book code is over 10,000 lines, not including many modules, so I cannot provide an example.
I’m using LuaGlider (formerly Cider), so I can see the objects in the variables panel.
Interesting facts:
- Modules I have called along the way appear as globals
- I am being careful to remove any Runtime event handlers
- There are tons of object event handlers I don’t get rid of before trying to remove the object, but the documentation says that’s ok.
- I’m not using any Corona widgets
My question is, can anyone tell me how to find out why I cannot get rid of this object? What’s the process, besides chopping away at 10,000+ lines of code to see what happens, i.e. brute-force? [import]uid: 37366 topic_id: 32416 reply_id: 332416[/import]