[debugallocation] grab entire stack trace of deletion

We used GetCallerStackTrace thingy before, but it is not entirely
reliable in it's detection of malloc stack frames (i.e. on OSX). So
lets do full thing instead. Those stacktraces are to be printed to
users anyways.
This commit is contained in:
Aliaksei Kandratsenka 2024-10-02 16:23:28 -04:00
parent 28c2853cba
commit 0aa7254ac9
1 changed files with 4 additions and 7 deletions

View File

@ -202,13 +202,10 @@ struct MallocBlockQueueEntry {
num_deleter_pcs(0) {}
MallocBlockQueueEntry(MallocBlock* b, size_t s) : block(b), size(s) {
if (FLAGS_max_free_queue_size != 0 && b != nullptr) {
// Adjust the number of frames to skip (4) if you change the
// location of this call.
num_deleter_pcs =
MallocHook::GetCallerStackTrace(
num_deleter_pcs = tcmalloc::GrabBacktrace(
deleter_pcs,
sizeof(deleter_pcs) / sizeof(deleter_pcs[0]),
4);
1);
deleter_threadid = tcmalloc::SelfThreadId();
} else {
num_deleter_pcs = 0;