[haiku-bugs] Re: [Haiku] #12286: Menus seem to be leaking ports

  • From: "ttcoder" <trac@xxxxxxxxxxxx>
  • Date: Thu, 06 Aug 2015 11:28:44 -0000

#12286: Menus seem to be leaking ports
----------------------------------+----------------------------
Reporter: ttcoder | Owner: axeld
Type: bug | Status: new
Priority: high | Milestone: R1/beta1
Component: Kits/Interface Kit | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
----------------------------------+----------------------------

Comment (by ttcoder):

Great collaborative work :-) Puts me back on track to continue the hunt,
even surprised myself that I did find a few things.
The `mbar cached menu` port name might come from this (not certain):
http://cgit.haiku-os.org/haiku/tree/src/kits/interface/Menu.cpp#n2537

If so, the handling of `fCachedMenuWindow` seems to be okay so that
oriented me to the theory of a higher level leak, i.e. the whole BMenu
being leaked (and thus also its fCachedMenuWindow being leaked).

So I ran Michael's leak_analyser.sh against prefs/Mouse (Terminal takes
too long to run with the guarded heap) and it seems there are tons of
leaks. One can navigate through them by "diff'ing" between two sessions
though. If I open the top menufield in the second session (but not the
first) I see 3 new leaks appear. None of them are a BMenu, but the first
one seems worth addressing immediately, I will leave it to you folks to
confirm:

{{{
allocation: base: 0x45c37e8; size: 2072; thread: 2308; alignment: 1
<libroot.so> __wmemset + 0x64e (nearest)
<libroot.so> __wmemset + 0xa95 (nearest)
<libroot.so> memalign + 0x33
<libroot.so> malloc + 0x26
<libroot.so> __allocate_pthread + 0x21
<libroot.so> spawn_thread + 0x23
<libbe.so> BPrivate::MouseDownThread<BMenuField>::Go(void) + 0x2d
<libbe.so>
BPrivate::MouseDownThread<BMenuField>::TrackMouse(BMenuField *, void
(BMenuField::*)(BMenuField *, BPoint), void (BMenuField::*)(BMenuField *,
BPoint, unsigned long), long long) + 0x53
<libbe.so> BMenuField::MouseDown(BPoint) + 0x10b
<libbe.so> BWindow::DispatchMessage(BMessage *, BHandler *) +
0xd47
<libbe.so> BWindow::task_looper(void) + 0x290
}}}

Is it worth filing another ticket for that leaked thread ?

Once the above is dealt with I'll return to the supposed BMenu leak..
Or maybe before embarking on that, it would be interesting compile
libbe.so with [http://cgit.haiku-
os.org/haiku/tree/src/kits/interface/Menu.cpp#n50 this define] commented
out and see if the port leak disappears?

--
Ticket URL: <https://dev.haiku-os.org/ticket/12286#comment:11>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: