void free (const void* ptr) { assert (ptr > mmap_.ptr); assert (ptr <= (static_cast<uint8_t*>(mmap_.ptr) + mmap_.size)); assert (used_ > 0); used_--; BH_release (ptr2BH(ptr)); }
void GCache::free_common (BufferHeader* const bh) { assert(bh->seqno_g != SEQNO_ILL); BH_release(bh); #ifndef NDEBUG void* const ptr(bh + 1); std::set<const void*>::iterator it = buf_tracker.find(ptr); if (it == buf_tracker.end()) { log_fatal << "Have not allocated this ptr: " << ptr; abort(); } buf_tracker.erase(it); #endif frees++; switch (bh->store) { case BUFFER_IN_MEM: mem.free (bh); break; case BUFFER_IN_RB: rb.free (bh); break; case BUFFER_IN_PAGE: if (gu_likely(bh->seqno_g > 0)) { discard_seqno (bh->seqno_g); } else { assert(bh->seqno_g != SEQNO_ILL); bh->seqno_g = SEQNO_ILL; ps.discard (bh); } break; } rb.assert_size_free(); }