Re: g_key_file
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: g_key_file
- Date: Sat, 13 Jan 2007 16:42:06 +0100
On Sat, Jan 13, 2007 at 08:23:40AM -0500, Kevin DeKorte wrote:
I have an app that seemed to be working pretty well and then I added
support for updating a key_file every minute and all of a sudden my app
started leaking memory. I just want to make sure I'm not using the
key_file improperly. I seem to be losing about 100K per iteration of
this loop.
Here is the code
...
fprintf(file,"%s",g_key_file_to_data(sunflower->emerald_theme,NULL,NULL));
http://developer.gnome.org/doc/API/2.0/glib/glib-Key-value-file-parser.html#g-key-file-to-data
g_key_file_to_data()
Returns: a newly allocated string
...
Moreover, fprintf(f, "%s", s); is an expensive way of doing
fputs(s, file);. Also see g_file_set_contents() which can
set the file contents atomically.
Yeti
--
Whatever.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]