| 104 | } |
| 105 | |
| 106 | void BlockAllocator::Free(void* ptr) { |
| 107 | // AssertMainThread(); |
| 108 | for (size_t i = 0; i < block_count; i++) { |
| 109 | if (allocations[i].ptr == ptr) { |
| 110 | allocations_placements.FreeBits(allocations[i].block_index, allocations[i].block_count); |
| 111 | allocations[i] = BlockAllocation(); |
| 112 | return; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | vector<void*>::iterator backupit; |
| 117 | for (backupit = backup.begin(); backupit != backup.end(); backupit++) { |
| 118 | if (*backupit == ptr) { |
| 119 | OG_FREE(ptr); |
| 120 | backup.erase(backupit); |
| 121 | return; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | if (!no_log) { |
| 126 | LOGF << "Could not find an allocation for " << ptr << " unable to free." << endl; |
| 127 | } |
| 128 | } |
nothing calls this directly
no test coverage detected