mem_track.hpp

A set of macros to track how many instances of specific classes are made.

One way of tracking memory leaks is to simply count instances of classes. The macros here simplify this process.

To setup, every constructor for a class must incude EMP_TRACK_CONSTRUCT(CLASS_NAME), and every destructor must have EMP_TRACK_DESTRUCT(CLASS_NAME). Make sure to avoid implicit constructors/destructors or counts will be off.

To collect information, EMP_TRACK_COUNT(CLASS_NAME) will provide the current count for a specific class, and EMP_TRACK_STATUS will translate into a string providing information about all available classes.

Developer notes:

Todo:

Currently having issues with the memory map corruption. Perhaps it needs to use onload? Also, can try using JS maps instead? (only when using Emscripten.)

Note

Status: BETA