GCMemAlloced()

BlitzMax Forums/BlitzMax Beginners Area/GCMemAlloced()

GregBUG(Posted 2007) [#1]
just another question:

try this code:

' >>>>
Graphics 640, 480, 16
While Not KeyDown(key_escape)
Cls
DrawText "GC "+GCMemAlloced(), 10, 10
Flip
Wend
' <<<<

why the alloced memory is increased and decreasing?
no object alloced!

thanks!


grable(Posted 2007) [#2]
KeyDown,Cls,DrawText or Flip probably allocates some arrays/types in their code.


GregBUG(Posted 2007) [#3]
but with previus versions of bmax (1.24 with no synch mods)
this will not happens!

thanks!


tonyg(Posted 2007) [#4]
Your "GC " + gcmemalloced() creates a string object?
<edit> Hmmm... maybe not.
It seems to be related to the mouse moving so could it be filling some buffer?


JazzieB(Posted 2007) [#5]
Quite simply because the GC doesn't run every frame. Memory usage goes up to a certain point (which will vary depending on what you're doing and what objects you have), and then the GC kicks in and resets it.

If you want the behaviour before GC was automatic, stick a GCCollect after the Flip and see the difference.