Re: [Gc] Leak detector for libjansson
Ivan Maidanski
ivmai at mail.ru
Sun Mar 10 00:01:03 PST 2013
Hi Ilya,
Sorry for a long delay. You should compile libgc with -DFIND_LEAK and recompile libjansson with CFLAGS="--include <path_to_gc>/include/leak_detector.h" (some platforms could deal without recompilation but the former is more reliable).
Sample leak_test.c:
#include <stdlib.h>
void main(void) {
void *p;
int i;
for (i = 0; i < 3; i++)
p = malloc(1);
}
gcc -DFIND_LEAK -I include -c extra/gc.c
gcc --include include/leak_detector.h leak_test.c gc.o
./a.out
Output (addresses may vary):
Found 2 leaked objects:
0x20080fd0 (leak_test.c:8, sz=1, NORMAL)
0x20080fe8 (leak_test.c:8, sz=1, NORMAL)
Regards,
Ivan
Fri, 18 Jan 2013, 15:06 +04:00 from Илья Нечёса <nechosa at mail.ru>:
>Good afternoon. Sorry for bad English. I would like to ask a question
>about leak getector gc for libjansson.
>In my project, I use a lot of objects jansson and that need to monitor.
>When creating an object jansson allocated memory which is then freed
>with json_decref(). You could not tell how can you use your leak
>detector for objects libjansson? Thank you in advance for your response.
>Sincerely, Ilya Nechoysa
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20130310/69b75caf/attachment.htm
More information about the Gc
mailing list