About memory freeing ?

BlitzMax Forums/BlitzMax Programming/About memory freeing ?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I don't understand why my memory is not free after process ?
Because you aren't dereferenceing your banks, ie they still exsist as valid objects, and so aren't being garbagecollected.

Try this code instead:
Import Pub.ZLib

FlushMem
Print "MEM USED 1 : "+MemAlloced()+" / "+MemUsage()

Local MySourceBank:TBank=TBank.load("C:\Dev\42ninjas\bin\logo.png") 

Print "MEM USED 2 : "+MemAlloced()+" / "+MemUsage()

Local MyOutBank:TBank=CompressBank(MySourceBank)
MyOutBank.Save("C:\Dev\logo.bin") 

MyOutBank = Null
MySourceBank = Null

FlushMem

Print "MEM USED 3 : "+MemAlloced()+" / "+MemUsage()

End
Oh and I leave you with this quote from the manual:
Function MemFree( mem:Byte Ptr,size ) Free allocated memory.

The memory specified by mem must have been previously allocated by MemAlloc or MemExtend.