GetColor() alloc memory and never release on iOS?

Monkey Forums/Monkey Programming/GetColor() alloc memory and never release on iOS?

Jason.C(Posted 2012) [#1]
Just store color array in a local var in render loop. I found the memory allocation continuing increase with the tool xCode Instruments. It's mostly increased by gc_malloc of GetColor's array.

Why did the local array not destroyed after a loop finished?

code snip here:
[monkeycode]
Method OnRender:Int()
Cls

Local color := GetColor()

Return 0
End
[/monkeycode]


Jason.C(Posted 2012) [#2]
Maybe it's a GC problem.

The memory will increase fast with following code . All strings and arrays allocated locally are not destroyed.

[monkeycode]
Method OnRender:Int()
Cls

For Local i:=0 To 100000
Local color := ["1", "2", "3"]
End

Return 0
End

[/monkeycode]

Do you have the same problem?


AdamRedwoods(Posted 2012) [#3]
the GC collects after OnUpdate or OnRender are done.


ziggy(Posted 2012) [#4]
In my opinion this is not very elegant specially when combined with the new targets design.Mark mentioned something about a realtime gc for c++ a while ago


Shinkiro1(Posted 2012) [#5]
I would love to be able to call the GC manually, much like in BlitzMax.