Using g_mem_profiler_table



Hi all,

I'm trying to use g_mem_profile to get a comparison of memory usage for several approaches in a GTK application. But I get a realloc error if I set things up by calling g_mem_set_vtable(glib_mem_profiler_table). Any ideas why?

Here's a basic C program:
#include <gtk/gtk.h>
#include <glib.h>

int main( int argc, char** argv )
{
  g_mem_set_vtable( glib_mem_profiler_table );
  gtk_init( &argc, &argv );

  return 0;
}

I compile with:
$ gcc `pkg-config gtk+-3.0 --cflags` mem-basic.c -o mem-basic `pkg-config gtk+-3.0 --libs`

But when I run it:
$ ./mem-basic
*** Error in `./mem-basic': realloc(): invalid pointer: 0x0000000001af7e80 ***
Aborted (core dumped)

This is on Ubuntu 14.04 (GTK 3.10.8, glib 2.40.2). This is my first time attempting to g_mem_profile, so don't assume I've done any of the obvious things yet.

Thanks,
Robert



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