Garbage Collections

BlitzMax Forums/BlitzMax Programming/Garbage Collections

Boulderdash(Posted 2006) [#1]
Hi, I have noticed from forum posts that quite a few people have run into problems with BMAX crashing after extended periods and such, I also had the similar problem so I thought that it would be useful to others if I posted my solution even though its no doubt been addressed before.

1. set GC mode to manual collections

GCSetMode(2)

then at the end of my main loop...


GCCollect
Flip


I did a GC every frame, WHOA, memory usage stopped creaping up and believe it or not it cured the wicked picture shearing I was getting on scrolling backgrounds! and the program still could achieve 850+ FPS as before.

I was incidently testing this on an emulator I ported from Blitz-3D, BMAX had much lower CPU usage than B3D and the Executable was one tenth of the size becuase my emulator does not use 3D.

Also BMAX went and run circles around its C equivilant speed wise, so C is not faster than BMAX , C is faster than micro soft basic V1.0(1982)


H&K(Posted 2006) [#2]
I believe any topic you have seen about gc crashes were pre 1.18
Not sur thou


Boulderdash(Posted 2006) [#3]
I stand corrected , I have only updated my BMAX last week, so I tried removing GC code and you are correct, this is no longer an issue.