Re: GConf



Hi,
	I just missed that line.  g_free(str);

	I am just worried about the output of g_mem_profile(), when i am using
gconf. Just checkout the output of g_mem_profile().

GLib Memory statistics (failing operations):
 --- none ---
Total bytes: allocated=199865, zero-initialized=11936 (5.97%),
freed=179441 (89.78%), remaining=20424
MemChunk bytes: allocated=11864, freed=0 (0.00%), remaining=11864

Anil

On Sun, 2002-10-20 at 21:06, Havoc Pennington wrote:
> 
> 
> Anil Kumar Putla <anil gdit iiit net> writes:
> > 
> > 	I would like to know whether gconf-1.0.9 is usable in application
> > programs. When i am using the library with mem profile it is showing
> > memory leaks. Am i not calling the appropriate destroy routines. 
> 
> You need to g_free the "str" variable.
> 
> Havoc
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list

#include <gconf/gconf-client.h>
#include <glib.h>

int main()
{
	GConfClient *client;
	extern GMemVTable *glib_mem_profiler_table;
	gchar *str;

	g_mem_set_vtable(glib_mem_profiler_table);

	client = gconf_client_get_default ();

	gconf_client_add_dir (client, "/apps/gedit-2", 
			GCONF_CLIENT_PRELOAD_NONE, NULL);

	str = gconf_client_get_string (client, "/apps/gedit-2/preferences/editor/font/editor_font",
		       	NULL);

	if (str)
		puts(str);
	else
		puts("NULL");

	g_free(str);

	g_object_unref(G_OBJECT(client));

	g_mem_profile();

	return 0;
}


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