I am Lost regarding Memory / Leaking?

Hello All, I was hoping I could get some help regarding Memory Leaks. I have been all over the forums and I am not quite understanding yet.

This is the code I have put into my files at the beginning of each file.

[code]
local function garbagePrinting()
collectgarbage(“collect”)
print("Memory: " … collectgarbage(“count”))
end

garbagePrinting()[/code]

I am running the main.lua file, and I am using Director to then change back and forth between FILE ONE & FILE TWO, with the increase of the number does this mean I have a “memory leak”?

This is what I am getting via the Terminal.

MAIN-begin
Memory: 68.515625
MAIN-end
FILE ONE-begin
Memory: 93.6748046875
FILE ONE-end
FILE TW0-begin
Memory: 123.912109375
FILE TWO-end
FILE ONE-begin
Memory: 159.7666015625
FILE ONE-end
FILE TW0-begin
Memory: 138.197265625
FILE TWO-end
FILE ONE-begin
Memory: 160.1845703125
FILE ONE-end
FILE TW0-begin
Memory: 138.521484375
FILE TWO-end
FILE ONE-begin
Memory: 160.5830078125
FILE ONE-end
FILE TW0-begin
Memory: 138.892578125
FILE TWO-end
FILE ONE-begin
Memory: 160.9072265625
FILE ONE-end

Thanks in Advance for any assistance.

[import]uid: 16527 topic_id: 7370 reply_id: 307370[/import]

It looks like a leak, yeah. A pretty small one but still. [import]uid: 12108 topic_id: 7370 reply_id: 26034[/import]

@jhocking

Ok, Thanks

Now I have to figure out where it is coming from.

I noticed your other thread; did you ever find any issues with using the UI.lua file?

Also, if I wanted to “clean” my files the way Ricardo mentions to using his “clean” function.

function clean ( event ) --(something is called here; right? I am not sure how to implement this code) print("cleaned") end [import]uid: 16527 topic_id: 7370 reply_id: 26048[/import]

I eventually wrote a little loop that goes through all the children of the button removing them before removing the button itself. I don’t think this is really necessary though, I’m just kinda paranoid.

The small memory leak referred to in my other thread turned out to be a bug with physics that Ansca is fixing. If you want to find out more about that bug, start here and then use the forum search:
http://developer.anscamobile.com/forum/2010/12/27/leak-or-me-not-getting-it

My current project doesn’t use physics and I use many buttons without memory leaks. [import]uid: 12108 topic_id: 7370 reply_id: 26099[/import]