Tim,
There are a number of places in AST where "one-off memory leaks"
occur - that is, places where memory is allocated once upon initialisation
of AST, but never released. This should not be a problem because, even
when running monolith commands in a loop, the memory is only allocated
once, and so does not amount to much. The stack traces you list below
look like such one-off memory leaks.
At the moment though, I cannot make valgrind give me these errors (that
is, running your program under valgrind --tool=memcheck gives me zero
errors). Which valgrind tool did you use?
David
On Tue, 12 Oct 2004, Tim Jenness wrote:
> David,
>
> This simple fortran program:
>
> * Simple link test of AST for the fortran interface
> PROGRAM AST_FTEST
> INCLUDE 'AST_PAR'
> INTEGER STATUS
> INTEGER FITSCHAN
>
> STATUS = 0
>
> CALL AST_BEGIN( STATUS )
> FITSCHAN = AST_FITSCHAN( AST_NULL, AST_NULL,
> : ' ', STATUS )
>
> CALL AST_ANNUL( FITSCHAN, STATUS )
> CALL AST_END( STATUS )
>
>
> END
>
> leaks memory. Do you know what I am doing wrong? (this is a cut down
> version of some code from SURF - it gets worse if a real fits header
> is stored).
>
> valgrind reports:
>
> ==14293== 52 bytes in 3 blocks are possibly lost in loss record 1 of 2
> ==14293== at 0x4002965E: malloc (vg_replace_malloc.c:153)
> ==14293== by 0x4030CB4C: astMalloc_ (memory.c:707)
> ==14293== by 0x4030CA3C: astGrow_ (memory.c:489)
> ==14293== by 0x4030E1E5: astSetCopy_ (object.c:1781)
> ==14293== by 0x402590FA: astInitFitsChanVtab_ (fitschan.c:14077)
> ==14293== by 0x40271C57: astInitFitsChan_ (fitschan.c:32585)
> ==14293== by 0x40271BC4: astFitsChanForId_ (fitschan.c:32419)
> ==14293== by 0x4024622F: ast_fitschan_ (ffitschan.c:253)
> ==14293==
> ==14293==
> ==14293== 64 bytes in 4 blocks are possibly lost in loss record 2 of 2
> ==14293== at 0x40029BD8: realloc (vg_replace_malloc.c:310)
> ==14293== by 0x4030CC33: astRealloc_ (memory.c:833)
> ==14293== by 0x4030CA72: astGrow_ (memory.c:506)
> ==14293== by 0x4030F616: astBegin_ (object.c:3686)
> ==14293== by 0x402743C7: ast_begin_ (fobject.c:86)
> ==14293== by 0x80487A1: MAIN__ (in /export/data/timj/tmp/star/cvs/libraries/ast/a.out)
> ==14293== by 0x8048845: main (in /export/data/timj/tmp/star/cvs/libraries/ast/a.out)
> ==14293== by 0x4045AAB6: __libc_start_main (in /lib/libc-2.3.2.so)
>
>
> --
> Tim Jenness
> JAC software
> http://www.jach.hawaii.edu/~timj
>
|