Re: [gmime-devel] Memory leaks while compiling a test gmime c code



Hi Paul,

I think that it probably did not help that GMime used to be inconsistent (at least in the 2.2 days) in that sometimes foo_get_bar() would ref and sometimes it wouldn't.

These days, at least with 2.6 (and I think 2.4 as well), foo_get_bar() APIs should never ref their returned object.

The only time a function should ever return a ref'd object is if it creates a new one.

The other place objects get ref'd is when they get added to a parent object (e.g. adding a GMimePart to a GMimeMultipart - the GMimeMultipart will take a ref on the GMimePart).

Hope that helps clear up any confusion,

Jeff


From: "Paul J Stevens" <paul nfg nl>
To: "Ashay Chitnis" <chitnis ashay gmail com>
Cc: gmime-devel-list gnome org
Sent: Friday, November 23, 2012 5:24:28 AM
Subject: Re: [gmime-devel] Memory leaks while compiling a test gmime c code

On 11/22/2012 03:16 PM, Ashay Chitnis wrote:
> Since I would be running a modified on gmime lib as a daemon thus I
> didn't want accumulated non-freed memory usage over a time.

I very much sympathize. Using gmime extensively in DBMail - which is a
long-running threaded imap server, relying on process exits for
releasing possible leakage - or worse; fragmentation - is not an option.

For all it's glorious features - which I love - GMime/GLib has been a
pain in this regard.

One main problem has always been the object reference counter magic that
- at least to me - is totally opaque. Quite often it is completely
unclear when a call increases the reference counter.

For that I've adopted a nice monkey patch on the glib object system that
will report reference leaks.

Upstream is at:

http://cgit.collabora.com/git/user/danni/gobject-list.git/

but I've added a few small enhancements to be found at

http://git.dbmail.eu/paul/gobject-list/

Maybe this will help someone.

--
________________________________________________________________
Paul J Stevens        pjstevns @ gmail, twitter, skype, linkedin

  * Premium Hosting Services and Web Application Consultancy *

           www.nfg.nl/info nfg nl/+31.85.877.99.97
________________________________________________________________
_______________________________________________
gmime-devel-list mailing list
gmime-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gmime-devel-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]