MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / ensureAllFreed

Function ensureAllFreed

Engine/source/platform/platformMemory.cpp:827–857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

825/// @note Only works if TORQUE_DISABLE_MEMORY_MANAGER is not defined; otherwise this is a NOP.
826
827void ensureAllFreed()
828{
829#ifndef TORQUE_DISABLE_MEMORY_MANAGER
830
831 U32 numLeaks = 0;
832 U32 bytesLeaked = 0;
833
834 for( HeapIterator iter; iter.isValid(); ++ iter )
835 {
836 AllocatedHeader* header = ( AllocatedHeader* ) *iter;
837 if( !( header->flags & GlobalFlag ) )
838 {
839 // Note: can't spill profile paths here since they by
840 // now are all invalid (they're on the now freed string table)
841
842#ifdef TORQUE_DEBUG_GUARD
843 Platform::outputDebugString( "MEMORY LEAKED: 0x%x %i %s %s:%i = %i (%i)",
844 header->getUserPtr(),
845 header->allocNum,
846 ( header->flags & StaticFlag ? "(static)" : "" ),
847 header->fileName, header->line, header->realSize, header->size );
848 numLeaks ++;
849 bytesLeaked += header->size;
850#endif
851 }
852 }
853
854 if( numLeaks )
855 Platform::outputDebugString( "NUM LEAKS: %i (%i bytes)", numLeaks, bytesLeaked );
856#endif
857}
858
859struct MemDumpLog
860{

Callers 1

_ensureAllFreedFunction · 0.85

Calls 2

isValidMethod · 0.45
getUserPtrMethod · 0.45

Tested by

no test coverage detected