Re: all about gobject references

A little off-topic, resp. about a similar issue, but I haven't found any
reason for it:
I read about using g_mem_set_vtable( glib_mem_profiler_table ) and using
g_atexit( g_mem_profile ). Even in this short example, I still get
memory leaks reported:

#include	<stdlib.h>
#include	<gtk/gtk.h>
#include	<glib.h>

int main( int argc, char** argv )
  g_mem_set_vtable( glib_mem_profiler_table );
  g_atexit( g_mem_profile );

  gtk_init( &argc, &argv );

  return EXIT_SUCCESS;
$ src/test
GLib Memory statistics (failing operations):
 --- none ---
Total bytes: allocated=967935, zero-initialized=120832 (12.48%),
freed=710216 (73.37%), remaining=257719

So even in this simple example there seem to occur memory leaks... I
guess this is not the case, is the memory really freed right away or
might it be freed after the program already exited?..
What just confuses me is the fact, that this should be a method for
chasing memory leeks, but in such a case, this is not usable.
Maybe someone can give a hint?

David Daniel

Am Samstag, den 22.08.2009, 19:32 +0200 schrieb Emmanuel Rodriguez:
> On Sat, Aug 22, 2009 at 3:12 PM, Tadej Borovšak <tadeboro gmail com>
> wrote:
>         Hi
>         > but when i put it throught valgrind tool it says 156 bytes
>         loss in memory
>         Analyzing glib code with valgrind requires some preparation or
>         false
>         positives are reported. Ask your favorite search engine about
>         this and
>         you should be able to find some documentation.
> Libchamplain's wiki [1] has a section named "Valgrind error
> suppression" that shows how to prepare valgrind to behave better with
> glib. The instructions should be easy to adapt to any project.
> [1]
> -- 
> Emmanuel Rodriguez
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org

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