Memory problem

BlitzMax Forums/BlitzMax Beginners Area/Memory problem

Hi,

I have problems releasing memory.
If i remove Flushmem from the example it leaks memory.
Removing the image is not releasing the memory.

Global img

Graphics 800,600,0,75
While Not KeyHit(Key_Escape)

If KeyHit(Key_Space) Then img = LoadImage("media/gui/splash01.png")
If KeyHit(Key_Return) Then img = 0

If img Then DrawImage(img,100,100)

DrawText "MemAlloc: " + MemAlloced(),10,10
DrawText "MemUsage: " + MemUsage(),210,10


Flip
Cls
FlushMem()
Wend

End


Thx