void FreeTrackData::VerifyAll(DebugData& debug) { // Make sure the stl calls below don't call the debug_XXX functions. ScopedDisableDebugCalls disable; for (const auto& header : list_) { VerifyAndFree(debug, header, debug.GetPointer(header)); } list_.clear(); }
void FreeTrackData::Add(DebugData& debug, const Header* header) { // Make sure the stl calls below don't call the debug_XXX functions. ScopedDisableDebugCalls disable; pthread_mutex_lock(&mutex_); if (list_.size() == debug.config().free_track_allocations) { const Header* old_header = list_.back(); VerifyAndFree(debug, old_header, debug.GetPointer(old_header)); list_.pop_back(); } if (backtrace_num_frames_ > 0) { BacktraceHeader* back_header = reinterpret_cast<BacktraceHeader*>( g_dispatch->malloc(sizeof(BacktraceHeader) + backtrace_num_frames_ * sizeof(uintptr_t))); if (back_header) { back_header->num_frames = backtrace_get(&back_header->frames[0], backtrace_num_frames_); backtraces_[header] = back_header; } } list_.push_front(header); pthread_mutex_unlock(&mutex_); }
void RearGuardData::LogFailure(DebugData& debug, const Header* header) { GuardData::LogFailure(header, debug.GetPointer(header), debug.GetRearGuard(header)); }