On 07/18/2011 03:40 AM, Bastian Pfennigschmidt wrote:
Good to hear.
Hmmm. My shutdown() code might not be 100% correct, then. Perhaps it is not resetting some variables.
g_mime_shutdown() was designed for programs which wanted to load and unload libgmime-2.so dynamically using dlopen() so that when they unloaded libgmime-2.so, they didn't leak a ton of memory.
You need to call g_object_unref() on gfs, parser, and message once you are done using them (to prevent a leak). Otherwise, the code looks ok.
I'll take a look into shutdown() and see if I find anything obvious that would cause this problem, but it would probably be best for you to not repeatedly call g_mime_init() and g_mime_shutdown(). Instead, call g_mime_init() at program start and g_mime_shutdown() at program exit.
Hope that helps,