MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / checkPtr

Function checkPtr

Engine/source/platform/platformMemory.cpp:795–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

793/// @note This function does not allow interior pointers!
794
795void checkPtr( void* ptr )
796{
797 for( HeapIterator iter; iter.isValid(); ++ iter )
798 {
799 AllocatedHeader* header = ( AllocatedHeader* ) *iter;
800 if( header->getUserPtr() == ptr )
801 {
802#ifdef TORQUE_DEBUG_GUARD
803 char buffer[ 1024 ];
804 if( !checkGuard( *iter, true ) )
805 {
806 dSprintf( buffer, sizeof( buffer ), "0x%x is a valid heap pointer but has its guards corrupted", ptr );
807 Platform::outputDebugString( buffer );
808 return;
809 }
810 //dSprintf( buffer, sizeof( buffer ), "0x%x is a valid heap pointer", ptr );
811 //Platform::outputDebugString( buffer );
812#endif
813 return;
814 }
815 }
816
817 char buffer[ 1024 ];
818 dSprintf( buffer, sizeof( buffer ), "0x%x is not a valid heap pointer", ptr );
819 Platform::outputDebugString( buffer );
820
821 Platform::debugBreak();
822}
823
824/// Dump info on all memory blocks that are still allocated.
825/// @note Only works if TORQUE_DISABLE_MEMORY_MANAGER is not defined; otherwise this is a NOP.

Callers 1

verifyStateMethod · 0.85

Calls 4

checkGuardFunction · 0.85
dSprintfFunction · 0.85
isValidMethod · 0.45
getUserPtrMethod · 0.45

Tested by

no test coverage detected