Game Development Community

Memory Manager - Idiot Proof Explanation?

by Steve Acaster · in Torque 3D Professional · 08/07/2010 (8:02 pm) · 1 replies

Quote: Matt FairFax's Changelog T3D 1.1 beta 2 release blog

Made the Torque Memory Manager compilable in Release builds

Is there an idiot proof, plain-speech explanation of exactly what "Memory Manger" does?

ta.

#1
08/08/2010 (8:25 pm)
Memory size isn't infinite. As such it's a resource that needs to be managed. This is done by memory managers. These are either automatic (some form "garbage collection" that automatically detects memory that is no longer in use by the program) or manual (programmer explicitly says when a piece of memory is no longer needed and can be reused).

A default manual memory manager comes with the language runtime for C/C++ in the form of the malloc(), free(), and realloc() functions. The Torque Memory Manager simply is a replacement for these functions (it actually works on top of them though it could just as well directly plug into the platform virtual memory interface) that provides certain debugging aids like making sure that all allocated memory is freed on exit (necessary for clean DLL operation) and providing some simple integrity checking tools that can detect buffer overruns (code writing past the boundaries of its allocated memory) and the like.

Activating TMM causes Torque to consume more memory and probably also to perform slightly slower (not sure though how well VC's default allocator actually performs, though). It's only use is for engine debugging.