unsafe static void EnumerateGetAllocationInformationCallback(NativeUtility.MemoryAllocationType allocationType, int size, sbyte *fileName, int lineNumber, int allocationCount) { string fileInfo; if (fileName != null) { fileInfo = string.Format("{0}:{1}", new string( fileName ), lineNumber); } else { fileInfo = "NULL"; } allocations.Add(string.Format("{0} - type: {1}, size: {2} x {3} = {4} (file: {5})", allocationItemName, allocationType, size, allocationCount, size * allocationCount, fileInfo)); totalAllocationSize += (ulong)(size * allocationCount); }
/////////////////////////////////////////// public static void GetStatistics(NativeUtility.MemoryAllocationType allocationType, out long allocatedMemory, out int allocationCount) { LoadUtilsNativeWrapperLibrary(); MemoryManager_GetStatistics(allocationType, out allocatedMemory, out allocationCount); }
static extern void MemoryManager_GetStatistics(NativeUtility.MemoryAllocationType allocationType, out long allocatedMemory, out int allocationCount);