Generating a heap report
The SpeedTree Runtime SDK has a mechanism for generating a report that describes every heap allocation made by the Runtime SDK and anything else that uses the memory management functions in Include/SpeedTree/Core/Memory.h.
Read time 2 minutesLast updated 2 hours ago
The tracked allocations include virtually everything in the reference application, save heap allocations made by other libraries used there (DXUT, glew, etc.) and the graphics APIs themselves. All of the SpeedTree-related classes in the reference application are set up to use the Runtime SDK memory interface.
This section of the document details how to generate a report of every heap allocation routed through this interface. This report is also a good way to track memory leaks for anything using the system. Imbalanced and calls will be revealed in the report.
newdeleteGenerating a report
You must recompile the SpeedTree Runtime SDK in order to generate a report. Enable heap allocation tracking by adding at the top of in the Core library (it is there by default, commented out around line 40). Comment back in for a very detailed heap allocation report (warning: it can be lengthy).
#define ST_MEMORY_STATSInclude/SpeedTree/Core/Allocator.h#define ST_MEMORY_STATS_VERBOSEThe next step will be to make a single call from within the client engine or application:
#include "Core/Memory.h"...SpeedTree::CAllocator::Report("my_report.csv", true);
Notes
-
The boolean parameter tospecifies whether the current tracking records should be flushed after the report is complete. If true, only allocations made after the report is generated will be tracked. If false, it will only provide a snapshot of that instant in time without modifying the table.
CAllocator::Report() -
Thefunction generates a .csv file. Files of this format can be imported into most spreadsheets.
CAllocator::Report() -
Any new calls that have not been released with a corresponding delete will be shown in the report. Therefore, be sure to place the report call appropriately.
-
If a call is made toand the Runtime SDK has not been compiled with
CAllocator::Report()active, a series of linker errors will be generated.#define ST_MEMORY_STATS