Memory leaks

Yang Zhang <[email protected]> Thu, 20 Nov 2008 06:27:15 -0500
Newsgroups gmane.comp.lib.state-threads.user
Message-ID <[email protected]>
When running this simple program:

#include <st.h>
int main() {
   st_init();
   return 0;
}

valgrind complains about memory leaks:

==745== 56 bytes in 1 blocks are still reachable in loss record 1 of 3
==745==    at 0x4C230BC: calloc (vg_replace_malloc.c:397)
==745==    by 0x401C3F: _st_stack_new (in /tmp/a.out)
==745==    by 0x40170F: st_thread_create (in /tmp/a.out)
==745==    by 0x4018DD: st_init (in /tmp/a.out)
==745==    by 0x401144: main (in /tmp/a.out)
==745==
==745==
==745== 448 bytes in 1 blocks are still reachable in loss record 2 of 3
==745==    at 0x4C230BC: calloc (vg_replace_malloc.c:397)
==745==    by 0x40192B: st_init (in /tmp/a.out)
==745==    by 0x401144: main (in /tmp/a.out)
==745==
==745==
==745== 12,680 bytes in 1 blocks are still reachable in loss record 3 of 3
==745==    at 0x4C23FAB: malloc (vg_replace_malloc.c:207)
==745==    by 0x403F59: _st_select_init (in /tmp/a.out)
==745==    by 0x4018A5: st_init (in /tmp/a.out)
==745==    by 0x401144: main (in /tmp/a.out)

More arise as I introduce netfds into the program.  As far as I can 
tell, it's not an enormous issue, but is annoying when valgrind is being 
used as a continuous integration tool for monitoring code health.  Any 
fixes?
-- 
Yang Zhang
http://www.mit.edu/~y_z/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/