PDA

View Full Version : createControl memory leak?



Toadwart
September 12th, 2007, 22:06
Have been playing around with createControl recently and noticed that it appears to be chewing through large chunks of memory and not releasing it.
Creating many stringcontrols (around 200) within a subwindow then calling destroy on each of them when that subwindow is closed.
Memory usage for the FG exe goes up by about 15MB each time the controls are created and doesn't shrink noticeably when they are destroyed.
Is there a potential problem here or will garbage collection eventually start releasing the memory?

joshuha
September 12th, 2007, 22:12
Do any of these controls have update handlers associated with them?

LUA is supposed to have built in garbage collection for all its objects but I don't know how often FG has implemented that to run (or if it's not working at all).

Toadwart
September 12th, 2007, 22:55
No update handlers. Currently they are just read-only text fields.
However, might not be as bad as I originally thought.
The memory consumption jumps up in big chunks till it gets to around 220mb then it slows significantly. Still appears to be growing by a meg or so each time the controls are created but might not be a problem. Will have to see how it behaves when used for several hours...

Dachannien
September 13th, 2007, 02:58
If extended testing causes some of the symptoms I described in this post (https://www.fantasygrounds.com/forums/showthread.php?t=6903), let us know. I suspect that problem is something different (some sort of resource leak rather than a memory leak), but you can never be sure (well... without the source code, anyway ;) ).