I'm using Glib v2.4.2. To re-create my suspicion, do the following: 1) create a file with the following (simple stuff) /* ghelloworld.c */ #include <glib.h> #include <mcheck.h> int main(void) { mtrace(); g_print("Hello World\n"); /* printf("Hello World\n"); */ muntrace(); return(0); } 2) build it > gcc -o ghelloworld ghelloworld.c `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0` > export MALLOC_TRACE='mtrace.log' > ./ghelloworld (outputs a mtrace.log to the cwd) > mtrace ghelloworld mtrace.log Memory not freed: ----------------- Address Size Caller 0x0804a378 0x20 at 0x4004f0d7 0x0804a3a0 0x14 at 0x4004f15f 0x0804a3b8 0x1e at 0x4004f0d7 0x0804a3f8 0x34 at 0x4004f0d7 0x0804a430 0x400 at 0x4004f0d7 0x0804a838 0xc at 0x4004f15f 0x0804a848 0x34 at 0x4004f0d7 0x0804a880 0x14 at 0x4004f0d7 0x0804a898 0x400 at 0x4004f0d7 0x0804aca0 0x34 at 0x4004f0d7 0x0804acd8 0x400 at 0x4004f0d7 3) Commenting out the g_print() and uncommenting out printf(), rebuilding, and then running ghelloworld over again yield no memory leaks (according to mtrace). Am I using g_print incorrectly? More specifically, am I misusing or not initializing something?
Attachment:
signature.asc
Description: This is a digitally signed message part