Cubism SDK‎ > ‎Live2D Library‎ > ‎Debug Function‎ > ‎

Detection of the Memory Leak (C++)

With C++ version there is a function to detect the leakage of the memory secured inside of Live2D.
It dumps the information about the memory which Live2D has secured from init() to dispose().

*This function is valid during DEBUG build only. (during _DEBUG with VisualStudio, and during DEBUG macro is valid with XCode.)

Example
//Set the flag before invoking init 
UtDebug::addMemoryDebugFlags( UtDebug::MEMORY_DEBUG_MEMORY_INFO_COUNT ) ;

Live2D::init(  );

/***** Generate or dispose of the model or the motion *****/

Live2D::dispose();//Display the memory information at this time.

Output examples
----------------- Live2D Memory Info -----------------
Successfully cleaned (no memory leaks found). 

  local malloc count  : remaining     : 0
  local malloc count  : total         : 48884
  local malloc memory : current       : 0 byte
  local malloc memory : peak          : 539 KB
  local malloc memory : total         : 1351 KB

  allocator malloc count  : remaining : 0
  allocator malloc count  : total     : 109
  allocator malloc memory : current   : 0 byte
  allocator malloc memory : peak      : 604 KB
  allocator malloc memory : total     : 802 KB

  LDObject           instance count : 1
  LDObject           total count    : 47303
  LDUnmanagedObject  instance count : 0
  LDUnmanagedObject  total count    : 1
------------------------------------------------------

The important items from the output are
local malloc count : remaining
and
allocator malloc count : remaining
If it is not 0, the objects related Live2D are not released.

Comments