Posts

Showing posts from January, 2011

Memory Management for the New Year

First of all happy new year everyone. I have been working a great deal resolving design issues in Enigma. Most of which caused by me creating hacks to detect issues without a debugger. However there are a few that are just run of the mill oversights. While reviewing these I have been thinking allot about memory management.

Here is what I have come up with so far regarding what seems to work best. For starters using reference variables instead of pointers when possible saves you allot of risk regarding memory leaks. Although in some cases the best solution is a point in which case role with it don't try to hack around it. Also if you have to store virtual base classes in a collection use boost shared pointer. No cleanup and it will get the job done with few hassles.

So far using the stack for variables that last for the life of the application works pretty well. I then use the heap for temporary variables. I think DotNet has a similar memory management strategy and I can see the adva…