Memory leak in 1.93

Archives Forums/Blitz3D Bug Reports/Memory leak in 1.93

Ross C(Posted 2006) [#1]
There seems to be a memory leak with 1.93, Foppy has discovered. I get it to, after updating to version 1.93

http://www.blitzbasic.com/Community/posts.php?topic=56141

If you run this code:

While(Not(KeyHit(1)))
	image = CreateImage(100,20)
	FreeImage(image)
Wend


System RAM usuage constantly increases. Didn't happen with versions of blitz <1.93. It seems like the image isn't being freed.


Robert Cummings(Posted 2006) [#2]
does this happen if you flip?


Foppy(Posted 2006) [#3]
It happens with the above code without flip, and also in my game, with flip.

Edit: adding a Flip to the above code slows down the memory leak but it is still there.


John Blackledge(Posted 2006) [#4]
Sorry - can't see it.
System memory jumps around (as always) but Windows causes that effect anyway.
Try this:
Type MEMORYSTATUS
    Field dwLength%
    Field dwMemoryLoad%
    Field dwTotalPhys%
    Field dwAvailPhys%
    Field dwTotalPageFile%
    Field dwAvailPageFile%
    Field dwTotalVirtual%
    Field dwAvailVirtual%
End Type
Global mem.MEMORYSTATUS = New MEMORYSTATUS

Graphics3D 800,600
While(Not(KeyHit(1)))
	image = CreateImage(100,20)
	FreeImage(image)
	UpdateWorld()
	RenderWorld()
	Cls
	GlobalMemoryStatus mem.MEMORYSTATUS
	Text 0,0,  "TotalVidMem "+TotalVidMem()
	Text 0,20, "AvailVidMem "+AvailVidMem()
	Text 0,40, "TotalSysMem "+Str$(mem\dwTotalPhys%/1024)+"k"
	Text 0,60, "AvailSysMem "+Str$(mem\dwAvailPhys%/1024)+"k"
	Flip
Wend



Foppy(Posted 2006) [#5]
That code gives a "Function GlobalMemoryStatus not found" error. I don't know what to replace that line with to get a readout of the remaining memory.

System memory doesn't really jump around on my computer, it just goes down rapidly (creating 100*100 images) when using 1.93, and this does not happen in 1.91.


Ross C(Posted 2006) [#6]
Do you use 1.93 John? This shouldn't happen though. In the other versions of blitz, this didn't happen.


Mikele(Posted 2006) [#7]
I use 1.93 and when I run this program my system memory goes down too.


OJay(Posted 2006) [#8]
same memory leak over here.

WinXP pro w/ SP2, Gf6800GT 256MB, Athlon XP2,8+, 1GB RAM, latest stable drivers.

maybe its a GeForce-issue? dunno...we need more specs! any ATI-users out there?


Foppy(Posted 2006) [#9]
My system:

P4 1.7Ghz 256Mb, WinXP home SP2, ATI Radeon 9600 256Mb


OJay(Posted 2006) [#10]
ok...its not os/hardware related then:
happens on xp pro AND home
on p4 AND amd
on ati AND nvidia

must be a real blitz3d bug then...so we're waiting for mark...again :)


BlitzSupport(Posted 2006) [#11]
Ouch... crashes here too, after about 10 seconds, with a blank error message.


John Blackledge(Posted 2006) [#12]
Yeah sorry about the MEMORYSTATUS thing - I must have it in a lib.

Doesn't matter anyway, since I was ill with the flu yesterday and totally missed the point that this is all about v1.93!


Ross C(Posted 2006) [#13]
Yep, i hope it's fixed soon, as it's a pretty serious bug.