CreateWindow Memory Leak

BlitzMax Forums/MaxGUI Module/CreateWindow Memory Leak

Rixarn(Posted 2010) [#1]
Hi!

I dont know if im doing something wrong here, but i belive that the free gadget command for window has a memory leak:


Import maxgui.maxgui
Import maxgui.drivers

Local lastCollected:Int
Local currentCollected:Int
For Local i:Int = 0 To 10
	Local w:TGadget = CreateWindow("TestWindow", 0, 0, 200, 200, Null)
	w.Free()
	w = Null
	GCCollect()
	lastCollected = currentCollected
	currentCollected = GCMemAlloced()
	Print "Leak:" + (currentCollected - lastCollected) + ":" + currentCollected
Next



It shows how memory is slowly leaking, at least in my computer..


skidracer(Posted 2010) [#2]
Changing the for next to a while true shows that memory usage stabilizes after first 30 or so iterations.


ima747(Posted 2010) [#3]
http://www.blitzbasic.com/Community/posts.php?topic=91435

Perhaps this is related? When loading large images it climbs and climbs... Seems the size of what you load determines how high the gc will climb before firing... Something makes me think there's a connection...


Rixarn(Posted 2010) [#4]
umm.. true, after some iterations memory stabilizes.. that's weird :S ... But i can live with that... at least it's not a real leak.

ima747, i don't know about that, but i'll read those posts to see what can i learn... thanks :)