| 825 | /// @note Only works if TORQUE_DISABLE_MEMORY_MANAGER is not defined; otherwise this is a NOP. |
| 826 | |
| 827 | void 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 | |
| 859 | struct MemDumpLog |
| 860 | { |
no test coverage detected