Frees storage allocated by LowLevelAlloc::Alloc(). L < arena->mu
| 412 | // Frees storage allocated by LowLevelAlloc::Alloc(). |
| 413 | // L < arena->mu |
| 414 | void LowLevelAlloc::Free(void *v) { |
| 415 | if (v != 0) { |
| 416 | AllocList *f = reinterpret_cast<AllocList *>( |
| 417 | reinterpret_cast<char *>(v) - sizeof (f->header)); |
| 418 | RAW_CHECK(f->header.magic == Magic(kMagicAllocated, &f->header), |
| 419 | "bad magic number in Free()"); |
| 420 | LowLevelAlloc::Arena *arena = f->header.arena; |
| 421 | if ((arena->flags & kCallMallocHook) != 0) { |
| 422 | MallocHook::InvokeDeleteHook(v); |
| 423 | } |
| 424 | ArenaLock section(arena); |
| 425 | AddToFreelist(v, arena); |
| 426 | RAW_CHECK(arena->allocation_count > 0, "nothing in arena to free"); |
| 427 | arena->allocation_count--; |
| 428 | section.Leave(); |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | // allocates and returns a block of size bytes, to be freed with Free() |
| 433 | // L < arena->mu |
nothing calls this directly
no test coverage detected