mem_track.hpp
A set of macros to track how many instances of specific classes are made.
This file is part of Empirical, https://github.com/devosoft/Empirical Copyright (C) 2015-2019 Michigan State University MIT Software license; see doc/LICENSE.md
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 include 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
Defines
-
INCLUDE_EMP_DEBUG_MEM_TRACK_HPP_GUARD