After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 479724 - Memory leak upon calling "g_main_loop_run" in the secondary thread, while main loop is already running
Memory leak upon calling "g_main_loop_run" in the secondary thread, while mai...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: mainloop
2.14.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2007-09-24 07:33 UTC by Areg Beketovski
Modified: 2007-12-20 20:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The test case reproducing the bug (4.91 KB, text/plain)
2007-09-24 07:35 UTC, Areg Beketovski
  Details
Proposed patch, fixing the problem (389 bytes, patch)
2007-09-24 07:36 UTC, Areg Beketovski
committed Details | Review

Description Areg Beketovski 2007-09-24 07:33:46 UTC
Please describe the problem:
When g_main_loop_run is being called in the secondary thread, while g_main_loop_run was already called and loop is running, the following part of code is being executed:

//*********************************
...
  if (!loop->context->cond)
    loop->context->cond = g_cond_new ();
...
//*********************************

This allocated condition is not being freed upon calling g_main_context_unref, and 48 bytes are being lost according to Valgrind. When POSIX threads are being used, g_cond_new () allocates internally a "pthread_cond_t" structure with sizeof(pthread_cond_t) = 48.

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
The detailed bug description can be found at: 

http://linuxtesting.org/results/report?num=D0005
Comment 1 Areg Beketovski 2007-09-24 07:35:30 UTC
Created attachment 96099 [details]
The test case reproducing the bug
Comment 2 Areg Beketovski 2007-09-24 07:36:12 UTC
Created attachment 96100 [details] [review]
Proposed patch, fixing the problem
Comment 3 Matthias Clasen 2007-11-08 04:11:31 UTC
2007-11-07  Matthias Clasen <mclasen@redhat.com>

        * glib/gmain.c (g_main_context_unref): Don't leak the
        condvar.  (#479724, Areg Beketovski)