Temporary image creation

BlitzMax Forums/BlitzMax Programming/Temporary image creation

Raz(Posted 2012) [#1]
I temporarily create some quite large images that I use to generate the game level before play time.

These images are no longer required once the game starts, so I am wondering if I should null the created images and force a garbage collection just before the start of play.

If I don't forcibly call garbage collection am I right in thinking the generated images (whose referrences I nulled) will be dealt with?

How much should I worry about GC?


col(Posted 2012) [#2]
When/if the variables to the TImage go out of scope or if you Null them then the GC will automatically clean up when its ready. The TImage will then release any graphics memory associated with it. There's nothing wrong with forcing a GCCollect() at the end if your 'initialization' phase to release the GPU memory if you're worried about someone possibly getting issues with GPU memory limits.