| 428 | } |
| 429 | |
| 430 | void ProfilerMemory::OnMemoryAlloc(void* ptr, uint64 size) |
| 431 | { |
| 432 | ASSERT_LOW_LAYER(Enabled && ptr); |
| 433 | auto& stack = GetGroupStack(); |
| 434 | if (stack.SkipRecursion) |
| 435 | return; |
| 436 | stack.SkipRecursion = true; |
| 437 | |
| 438 | // Register pointer |
| 439 | PointerData ptrData; |
| 440 | ptrData.Size = (uint32)size; |
| 441 | ptrData.Group = (uint8)stack.Peek(); |
| 442 | PointersLocker.Lock(); |
| 443 | Pointers[ptr] = ptrData; |
| 444 | PointersLocker.Unlock(); |
| 445 | |
| 446 | // Update group memory |
| 447 | const int64 add = (int64)size; |
| 448 | AddGroupMemory((Groups)ptrData.Group, add); |
| 449 | Platform::InterlockedAdd(&GroupMemory[(int32)Groups::Malloc], add); |
| 450 | Platform::InterlockedIncrement(&GroupMemoryCount[(int32)Groups::Malloc]); |
| 451 | UPDATE_PEEK(ProfilerMemory::Groups::Malloc); |
| 452 | |
| 453 | stack.SkipRecursion = false; |
| 454 | } |
| 455 | |
| 456 | void ProfilerMemory::OnMemoryFree(void* ptr) |
| 457 | { |
nothing calls this directly
no test coverage detected