| 454 | } |
| 455 | |
| 456 | void ProfilerMemory::OnMemoryFree(void* ptr) |
| 457 | { |
| 458 | ASSERT_LOW_LAYER(Enabled && ptr); |
| 459 | auto& stack = GetGroupStack(); |
| 460 | if (stack.SkipRecursion) |
| 461 | return; |
| 462 | stack.SkipRecursion = true; |
| 463 | |
| 464 | // Find and remove pointer |
| 465 | PointerData ptrData; |
| 466 | PointersLocker.Lock(); |
| 467 | auto it = Pointers.Find(ptr); |
| 468 | bool found = it.IsNotEnd(); |
| 469 | if (found) |
| 470 | ptrData = it->Value; |
| 471 | Pointers.Remove(it); |
| 472 | PointersLocker.Unlock(); |
| 473 | |
| 474 | if (found) |
| 475 | { |
| 476 | // Update group memory |
| 477 | const int64 add = -(int64)ptrData.Size; |
| 478 | SubGroupMemory((Groups)ptrData.Group, add); |
| 479 | Platform::InterlockedAdd(&GroupMemory[(int32)Groups::Malloc], add); |
| 480 | Platform::InterlockedDecrement(&GroupMemoryCount[(int32)Groups::Malloc]); |
| 481 | } |
| 482 | |
| 483 | stack.SkipRecursion = false; |
| 484 | } |
| 485 | |
| 486 | void ProfilerMemory::OnGroupUpdate(Groups group, int64 sizeDelta, int64 countDelta) |
| 487 | { |
nothing calls this directly
no test coverage detected