|
From: Admir E. <ef...@so...> - 2005-05-16 01:31:35
|
Hi! How do you go about checking for leaks using glib-2.0? I allocate memory with glib functions, mainly: - g_string_new() - for GString* - g_new() - for mostly everything else - g_free() - instead of doing free(). Now I believe the above functions use something like g_malloc, g_realloc, etc, which may or may not be macros (not sure). I have a multithreaded app, using glib and NPTL threads on gentoo linux. It goes something like: main.c spawns threads my_threads.c is the code where the actual leak is the valgrind reports leaks in following order: glib.2.xxx.so main.c or similar, the point being that it does not report where in my_threads.c the leak is. It doesnt mention my_threads.c at all. The memory leak is proportional to the amount of work done by threads, so I sure it is there. Is there a way to set g_new() or g_string_new() as aliases to malloc, even tho they don't have the same form? Just in order to make sure valgrind traces them as well? Or is the problem NPTL-related? Greetings, /Admir |
|
From: Dennis L. <pla...@in...> - 2005-05-17 04:28:56
|
Am Montag, den 16.05.2005, 03:31 +0200 schrieb Admir Efendic: > Hi! > > How do you go about checking for leaks using glib-2.0? I allocate memory > with glib functions, mainly: > - g_string_new() - for GString* > - g_new() - for mostly everything else > - g_free() - instead of doing free(). > > Now I believe the above functions use something like g_malloc, > g_realloc, etc, which may or may not be macros (not sure). > > I have a multithreaded app, using glib and NPTL threads on gentoo linux. > It goes something like: > > main.c spawns threads > my_threads.c is the code where the actual leak is > > the valgrind reports leaks in following order: > > glib.2.xxx.so > main.c > > or similar, the point being that it does not report where in > my_threads.c the leak is. It doesnt mention my_threads.c at all. Have you checked FAQ 4.4 so you use --num-callers for complete stacktrace and everything else to make stack trace more helpful ? |