Closed Bug 28986 Opened 25 years ago Closed 17 years ago

Lots of XInput leaks

Categories

(Core :: XUL, defect, P3)

Sun
Solaris
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: bruce, Assigned: karlt)

References

Details

(Keywords: memory-leak)

Do we really need to leak all of this:

I'm on Solaris 2.6, gcc 2.7.2.3.  These have been showing up for a while.

(And this is only part of it)

MLK: 4 bytes leaked at 0xbe7850
  * This memory was allocated from:
        malloc         [rtlib.o]
        _GetIMValues   [XSunIMIF.c]
        XGetIMValues   [ICWrap.c]
        gdk_im_real_open [gdkim.c:393]
        gdk_im_open    [gdkim.c:419]
        nsWidget::GetXIC() [nsWidget.cpp:2862]
        nsWidget::OnFocusInSignal(_GdkEventFocus*) [nsWidget.cpp:2133]
        nsWidget::FocusInSignal(_GtkWidget*,_GdkEventFocus*,void*) 
[nsWidget.cpp:2585]
        gtk_marshal_BOOL__POINTER [gtkmarshal.c:32]
        gtk_handlers_run [gtksignal.c:1909]
        gtk_signal_real_emit [gtksignal.c:1469]
        gtk_signal_emit [gtksignal.c:552]
        gtk_widget_event [gtkwidget.c:2784]
        gtk_window_real_set_focus [gtkwindow.c:1570]
        gtk_marshal_NONE__POINTER [gtkmarshal.c:216]
        gtk_signal_real_emit [gtksignal.c:1484]
        gtk_signal_emit [gtksignal.c:552]
        gtk_window_set_focus [gtkwindow.c:379]
        gtk_widget_real_grab_focus [gtkwidget.c:3102]
        gtk_marshal_NONE__NONE [gtkmarshal.c:363]
        gtk_signal_real_emit [gtksignal.c:1484]
        gtk_signal_emit [gtksignal.c:552]
        gtk_widget_grab_focus [gtkwidget.c:3020]
        gtk_entry_button_press [gtkentry.c:882]
        gtk_marshal_BOOL__POINTER [gtkmarshal.c:32]
        gtk_signal_real_emit [gtksignal.c:1484]
        gtk_signal_emit [gtksignal.c:552]
        gtk_widget_event [gtkwidget.c:2784]
        gtk_propagate_event [gtkmain.c:1295]
        gtk_main_do_event [gtkmain.c:752]

MLK: 4 bytes leaked at 0x560878
  * This memory was allocated from:
        malloc         [rtlib.o]
        _GetIMValues   [XSunIMIF.c]
        XGetIMValues   [ICWrap.c]
        gdk_im_real_open [gdkim.c:393]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 1 byte leaked at 0x560628
  * This memory was allocated from:
        malloc         [rtlib.o]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]
MLK: 8 bytes leaked at 0x57f2d8
  * This memory was allocated from:
        malloc         [rtlib.o]
        _GetIMValues   [XSunIMIF.c]
        XGetIMValues   [ICWrap.c]
        gdk_im_real_open [gdkim.c:393]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55f0e0
  * This memory was allocated from:
        malloc         [rtlib.o]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55eb38
  * This memory was allocated from:
        malloc         [rtlib.o]
        open_indirect_converter [lcConv.c]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55ee48
  * This memory was allocated from:
        malloc         [rtlib.o]
        create_conv    [lcDefConv.c]
        open_indirect_converter [lcConv.c]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55ecb8
  * This memory was allocated from:
        malloc         [rtlib.o]
        create_conv    [lcCT.c]
        open_indirect_converter [lcConv.c]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55ebf8
  * This memory was allocated from:
        malloc         [rtlib.o]
        open_indirect_converter [lcConv.c]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55e758
  * This memory was allocated from:
        malloc         [rtlib.o]
        open_indirect_converter [lcConv.c]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55e9a8
  * This memory was allocated from:
        malloc         [rtlib.o]
        create_conv    [lcDefConv.c]
        open_indirect_converter [lcConv.c]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55e698
  * This memory was allocated from:
        malloc         [rtlib.o]
        open_indirect_converter [lcConv.c]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]

MLK: 8 bytes leaked at 0x55e818
  * This memory was allocated from:
        malloc         [rtlib.o]
        create_conv    [lcCT.c]
        open_indirect_converter [lcConv.c]
        _XDefaultOpenIM [XSunIMIF.c]
        XOpenIM        [IMWrap.c]
        gdk_im_real_open [gdkim.c:376]
        gdk_im_open    [gdkim.c:419]
        gdk_init_check [gdk.c:433]
        gtk_init_check [gtkmain.c:199]
        gtk_init       [gtkmain.c:422]
        nsAppShell::Create(int*,char**) [nsAppShell.cpp:212]
        nsViewerApp::Initialize(int,char**) [nsViewerApp.cpp:343]
        main           [nsGtkMain.cpp:167]
        _start         [crt1.o]
reassigning to pavlov for triage.
Assignee: trudelle → pavlov
reassigning
Assignee: pavlov → tajima
Accepted. 
Status: NEW → ASSIGNED
Target Milestone: M16
spam, open xptoolkit qa contact moving over to jrgm
QA Contact: paulmac → jrgm
MLK occurs in libX11 of Solaris. A bug report was sent to Sun's bugtraq database
to see if
it has been already fixed or not.
I backed out the previous comments. The MLK seems to occur because XCloseIM()
and XFree()
are not called to clean up the memory allocated by XOpenIM() and XGetIMValues().
In Mozilla,
XOpenIM() and XGetIMValues() are called from gtk_init(), which is called from
nsAppShell.cpp,
so the memory is allocated at that time, but there is no gtk_exit() call, from
which
XCloseIM() is called to clean up the allocated memory. Frank, I suppose this is
bigger
problem than XIM. Will you please forward the problem to module owner of
widget/src/gtk/?


Need to call gtk_exit() to clean up the allocated resources.
Assignee: tajima → ftang
Status: ASSIGNED → NEW
Actually, these stopped showing up at some point, with the exception of a single
4-byte leak which has always been there.  The ones below had mysteriously shown
up for a while, but only when typing was actually being done.  I think this bug
can be closed out now.
pavlov- you know gtk the best. Does tajima's comment make sense- gtk_exit() ?
Because the lazy loading behavior in XIM, you probably need to type to force it 
to leak. But we should call gtk_exit() anyway, right ?
I search the LXR with gtk_exit in the text search and I can find nothing now.
Assignee: ftang → pavlov
Status: NEW → ASSIGNED
Summary: Lots of XInput leaks → Lots of XInput leaks -- need to call gtk_exit() atexit
Target Milestone: M16 → M18
mass-moving all bugs to m21 that are not dofood+, or nsbeta2+
Target Milestone: M18 → M21
we don't really want to call gtk_exit atexit because we want to clean up after
ourselves in an embedded app...  blizzard ?
Target Milestone: M21 → M25
If you're using it in an embedded app then you are responsible for calling
gtk_exit() yourself anyway.  nsIAppShell and embedding don't really mix.
If most of this is fixed could we resolve Fixed or worksforme? Also, how did
embedding come up? Are we saying that nsViewerApp should call the gtk_exit
instead of nsAppShell?
Looking at the current GTK source: http://cvs.gnome.org/lxr/ident?i=gtk_exit
gtk_exit just calls gdk_exit, which just calls exit.   Did older versions do
something more?
reassigning to tajimi-san, probably not worth fixing for N6. Pav concurs with
DBaron's comment above.
Assignee: pavlov → tajima
Status: ASSIGNED → NEW
Bruce, I have a cople of questions on your past comment. With
the lastest build, do you see any XIM leaks? What the single 4 byte
leak you had always seen? Do you still see?
Status: NEW → ASSIGNED
I don't see it at startup, but that's not surprising.  If this is something that 
leaks during shutdown (as you close XIM whatever stuff down), then I won't see 
it because I coredump in exit() right now when I run under Purify.  Do you have 
working Purify builds that don't suck like mine?
No, I don't have one right now, but I can try to create. Are you seeing coredump
with purify build on the recent cvs tree?
I see it on current CVS, but I don't think it is Mozilla.  It is probably an 
interaction between Purify, my compiler (gcc 2.7.2.3), and the Solaris system 
that I'm running.  Who knows what exactly is wrong though since Rational's tech 
support is making me understand how fast glaciers move.
reassign.
Assignee: tajima → katakai
Status: ASSIGNED → NEW
Blocks: 92580
No longer blocks: 92580
gtk_exit is just a wrapper for exit, so that's not what we want.

However, I've seen a whole bunch of leaks that would be helped if we called XCloseDisplay, and those reported here may be among them.
Blocks: 393890
Depends on: 394466
No longer blocks: 393890
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Depends on: 398512
This is actually not fixed by bug 394466, as XCloseIM is not called because the gtk module is unloaded before its display closed callback is called.

See the gtk bug for more info:
http://bugzilla.gnome.org/show_bug.cgi?id=483223
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Summary: Lots of XInput leaks -- need to call gtk_exit() atexit → Lots of XInput leaks
Assignee: masaki.katakai → mozbugz
Status: REOPENED → NEW
The patch in the gtk bug has been committed for gtk+-2.12.1, so I'm marking this as FIXED now.

The crash caused by older versions of gtk+ is bug 398512.
Status: NEW → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.