Memory Management / Garbage Collector

Started by VectorWorlds, January 15, 2020, 07:40:51 AM

Previous topic - Next topic

VectorWorlds

Hello

I've had my Vectrex32 for a few days now and I feel I'm getting somewhere now :).  One question I had though is how is the memory managed?  Is there a garbage collector that manages unassigned variables / arrays etc.  Just looking for tips on making sure I don't create any memory leaks etc?

Cheers


Andrew

Vectrex32

Hi Andrew,

The Vectrex32 uses reference counting to track objects. So when there's no longer a variable referencing an array, sprite, string, structure, or other object (in case I missed one) it is immediately freed.

Sprites in the drawing list are being referenced by the drawing list, so that keeps them alive. You don't need a separate variable referencing them.

- Bob

VectorWorlds

Thanks Bob.  This is good to know.  I'm loving playing with the Vectrex32 and hope to share some creations in the coming months as I get more proficient.

Cheers


Andrew