mozilla_sampler_register_thread leaks pseudostacks (40k per thread)

RESOLVED DUPLICATE of bug 872947

Status

()

defect
RESOLVED DUPLICATE of bug 872947
6 years ago
6 years ago

People

(Reporter: bjacob, Unassigned)

Tracking

Trunk
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [MemShrink])

I'm using the mozilla-graphics tree. I was told that this might be fixed on central already, but we recently merged -central (of June 24) into -graphics, and I can still reproduce.

See this log (scroll to the bottom): attachment 767554 [details]

These reports:

==9576== 40,992 bytes in 1 blocks are definitely lost in loss record 6,949 of 6,955
==9576==    at 0x402C7C1: malloc (vg_replace_malloc.c:292)
==9576==    by 0x4041EE4: moz_xmalloc (mozalloc.cpp:54)
==9576==    by 0x7E94F1B: mozilla_sampler_register_thread(char const*, void*) (mozalloc.h:201)
==9576==    by 0x83FD007: mozilla::LazyIdleThread::InitThread() (LazyIdleThread.cpp:173)
==9576==    by 0x6D9EF3C: nsRunnableMethodImpl<void (nsPACMan::*)(), true>::Run() (nsThreadUtils.h:350)
==9576==    by 0x84030DD: nsThread::ProcessNextEvent(bool, bool*) (nsThread.cpp:626)
==9576==    by 0x83B5404: NS_ProcessNextEvent(nsIThread*, bool) (nsThreadUtils.cpp:238)
==9576==    by 0x8402443: nsThread::ThreadFunc(void*) (nsThread.cpp:264)
==9576==    by 0x4089DFF: _pt_root (ptthread.c:204)
==9576==    by 0x4A2CE99: start_thread (pthread

The code is:

bool mozilla_sampler_register_thread(const char* aName, void* stackTop)
{
  PseudoStack* stack = new PseudoStack();
  tlsPseudoStack.set(stack);

  return Sampler::RegisterCurrentThread(aName, stack, false, stackTop);
}

So I'm assuming that we're leaking these PseudoStack's ? I don't see it being ever destroyed, e.g. in mozilla_sampler_stop() ?
Julian, would Valgrind correctly understand this thread-local global pointer, for reachability analysis?
Flags: needinfo?(jseward)
Sorry looks like I have landed my patch in 872947. I'll get around to it ASAP.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 872947
have not landed*
(In reply to Benoit Jacob [:bjacob] from comment #1)
> Julian, would Valgrind correctly understand this thread-local global
> pointer, for reachability analysis?

I think it does correctly understand it.  But in any case, a bug in this
area -- https://bugs.kde.org/show_bug.cgi?id=324227 -- was fixed in V 3.9.0,
so if this is still a concern, it might be worth trying 3.9.0.
Flags: needinfo?(jseward)
You need to log in before you can comment on or make changes to this bug.