Memory management
From WarzoneWiki
All objects are kept in global linked lists. Dead objects are moved from the general lists to special and seprate destroyed lists for a while until they are released for good. This ensures that pointer references remain valid. That also means a way to check that the objects are ready for release is needed.
The Pumpkin solution to this is that each object has a 'died' field which records the time frame it tied. At the end of the next turn, it is deleted. During the next turn, all objects are supposed to be iterated through by an appropriate update function that checks this 'died' field and change all references to dead objects. This way no object should point to the memory of a released object.
Take great care to ensure that all objects with 'died' field set have their references changed, or else the game will crash!


