Number: 2048
Title: memory leaks when using libgvc
Submitter: stefan Kost
Date: Tue Oct 5 05:14:47 2010
Subsys: Lib(c)graph
Version: 2.6
System: x86-Linux-
Severity: minor
Problem:
I have been discussing memory leak on the mailing list. By adding a little complexity (another subgraph) valgrind memcheck reports leaked memory. I will attach the minimal test program.


==11158== 7,240 (3,080 direct, 4,160 indirect) bytes in 10 blocks are definitely
lost in loss record 877 of 887
==11158==    at 0x402860A: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==11158==    by 0x4092517: gmalloc (memory.c:52)
==11158==    by 0x409257B: zmalloc (memory.c:30)
==11158==    by 0x46E1EA9: virtual_node (fastgr.c:247)
==11158==    by 0x46DD26C: class1 (class1.c:65)
==11158==    by 0x46E9E9A: dot_rank (rank.c:560)
==11158==    by 0x46EA6D3: collapse_cluster (rank.c:266)
==11158==    by 0x46E9E2D: collapse_sets (rank.c:294)
==11158==    by 0x46E9E92: dot_rank (rank.c:558)
==11158==    by 0x46E33A9: dot_layout (dotinit.c:261)
==11158==    by 0x4082A55: gvLayoutJobs (gvlayout.c:91)
==11158==    by 0x4088F2B: gvLayout (gvc.c:79)
==11158==    by 0x8048B8F: main (in /home/ensonic/projects/tests/gvc)
==11158==
==11158== 7,510 (840 direct, 6,670 indirect) bytes in 10 blocks are definitely
lost in loss record 878 of 887
==11158==    at 0x402860A: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==11158==    by 0x4092517: gmalloc (memory.c:52)
==11158==    by 0x409257B: zmalloc (memory.c:30)
==11158==    by 0x40A25E9: make_label (labels.c:113)
==11158==    by 0x409A667: do_graph_label (input.c:896)
==11158==    by 0x46EA6A8: collapse_cluster (rank.c:165)
==11158==    by 0x46E9E2D: collapse_sets (rank.c:294)
==11158==    by 0x46E9E92: dot_rank (rank.c:558)
==11158==    by 0x46E33A9: dot_layout (dotinit.c:261)
==11158==    by 0x4082A55: gvLayoutJobs (gvlayout.c:91)
==11158==    by 0x4088F2B: gvLayout (gvc.c:79)
==11158==    by 0x8048B8F: main (in /home/ensonic/projects/tests/gvc)

The first leak is gone when commenting out the sub-cluster code in the example (line 48ff).
Input file: b2048.c
Comments:
[erg] It is unnecessary to run the C program. Dot leaks on this graph, which is the graph built by the program.
Owner: *
Status: *