Some memory leaks as pointed out by Valgrind

Chris Shoemaker c.shoemaker at cox.net
Mon May 7 08:58:01 EDT 2007


On Mon, May 07, 2007 at 10:33:17AM +1000, conrad at mail.watersprite.com.au wrote:
> > On Sun, May 06, 2007 at 11:26:52PM +0200, Christian Stimming wrote:
> >> Here is some output of valgrind. This is with "gnucash --nofile" and
> >> directly
> >> terminating the program again. I'm trying to get some actual numbers for
> >> http://bugzilla.gnome.org/show_bug.cgi?id=431324 , but as one startup of
> >> gnucash with valgrind takes approx. 10 minutes :-) , I'm progressing
> >> quite
> >> slowly.
> 
> Yes, it is slow, isn't it.... :-)
> 
>  But some issues are there already:
> >>
> >> ==5392== 44,394 bytes in 1,676 blocks are definitely lost in loss record
> >> 251
> >> of 261
> >> ==5392==    at 0x4023515: malloc (vg_replace_malloc.c:149)
> >> ==5392==    by 0x559B265: g_malloc (in
> >> /opt/gnome/lib/libglib-2.0.so.0.1200.4)
> >> ==5392==    by 0x55AEA98: g_strdup (in
> >> /opt/gnome/lib/libglib-2.0.so.0.1200.4)
> >> ==5392==    by 0x557D5E3: g_cache_insert
> >> (in /opt/gnome/lib/libglib-2.0.so.0.1200.4)
> >> ==5392==    by 0x4055C20: qof_util_string_cache_insert (qofutil.c:296)
> >> ==5392==    by 0x4048EBF: qof_collection_new (qofid.c:101)
> >> ==5392==    by 0x404EDFB: qof_book_get_collection (qofbook.c:302)
> >> ==5392==    by 0x404ACC7: qof_instance_init_data (qofinstance.c:287)
> >> ==5392==    by 0x408EB74: book_sxes_setup (SX-book.c:251)
> >> ==5392==    by 0x40514E0: qof_object_book_begin (qofobject.c:66)
> >> ==5392==    by 0x404F3F6: qof_book_new (qofbook.c:88)
> >> ==5392==    by 0x40588E6: qof_session_new (qofsession.c:197)
> >> Seems like the keys in the g_cache should be explicitly free'd after
> >> use, but
> >> currently they aren't.
> > This leak is at least documented in book_sxes_setup().
> 
> I think this is the one I have a patch for... but I've probably done it
> the wrong way, so go ahead and fix it properly!

I'm not that familiar with that code, so I wasn't even planning on
fixing it.  Go ahead and send your patch.

-chris


More information about the gnucash-devel mailing list