Something eats memory

BlitzMax Forums/BlitzMax Programming/Something eats memory

void(Posted 2012) [#1]
' declare some type with object as field
Type sometype
Field name:String
End Type

' clear memory to clean test
GCCollect()

' used memory at start
Print GCMemAlloced() ' --- 17210

' creating object and putting in it some string
Local t:sometype=New sometype
t.name="some string"

' memory incrased, all cool
Print GCMemAlloced() ' --- 17244

' seems like t is not need anymore - make it null
t=Null

' clearing memory
GCCollect()

' o_O something do not deleted
Print GCMemAlloced() ' --- 17222


Result of this example is
17210
17244
17222

I tried to remove string
t.name=null
t=Null

...same results

tried like this
t.name=""
t.name=null
t=null

:( same result.

I'm writing some text parser and it eats memory - and don't free it. Maybe i can't use bMax, does anybody has same trouble?


void(Posted 2012) [#2]
It's only "String" bug, with numbers works correct.


ziggy(Posted 2012) [#3]
You need to set the GC mode to manual collection for this sample to be reliable.