Vectrex32

General Category => General Discussion => Topic started by: VectorWorlds on January 15, 2020, 07:40:51 AM

Title: Memory Management / Garbage Collector
Post by: VectorWorlds on January 15, 2020, 07:40:51 AM
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
Title: Re: Memory Management / Garbage Collector
Post by: Vectrex32 on January 15, 2020, 08:08:19 AM
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
Title: Re: Memory Management / Garbage Collector
Post by: VectorWorlds on January 15, 2020, 01:43:34 PM
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