Memory leaks in standard code

Paul Richard Thomas paul.richard.thomas@gmail.com
Wed Feb 27 10:17:00 GMT 2008


FX,

>  OK, I've managed to fix my hashtab code, and I've reworked the error
>  messages a bit, so your testcase now gives:

This new version of your patch segfaults at line 165 of memory_check.c
with x86_ia64/FC8.  Should this line not be:

      if (*slot != HTAB_DELETED_ENTRY)
        free (*slot);

?

I have to confess that I am not clear if *slot == HTAB_DELETED_ENTRY
corresponds to an error condition or not:)

The test that I performed is with the patched version of the
alloc_comp code, as I remarked in the first email in this thread.
With the above modification to memory checking, it gives no memory
leaks, which is what the 'original' code is telling me.

Several other members of the allocatable component members of the
testsuite show memory leaks, however.  Many thanks for a brilliant
tool!

In fact, I am begining to think that your hashtab functions should be
used for allocatable components as a matter of course.  Erik and I had
a notion to do something of the sort in the first place.

Cheers

Paul

>
>  $ ./bin/gfortran a.f90 -static -fruntime-check=memleaks && ./a.out
>
>
>  Fortran runtime checking: found 1 memory leaks
>   !! Memory leak in the code generated by the GNU Fortran compiler.
>   !! Please report this issue to http://gcc.gnu.org/bugzilla/
>
>  Peak user-allocated memory: 0.00 B
>  Peak memory created by the compiler for temporaries: 24.0 B
>
>
>
>  I attach the new patch here; only the libgfortran/ diff is included,
>  the front-end part is untouched; Makefile.in diff is included :)
>  It fixes the hashtab issue, adds better error messages and should
>  support calls to realloc(). I'm still unsure when exactly these calls
>  are triggered, so if you can provide me with one of more testcases
>  (or name of testcases from the testsuite), I'd be glad to try it. For
>  now, that part is still untested.
>
>  FX
>
>
>
>  --
>  François-Xavier Coudert
>  http://www.homepages.ucl.ac.uk/~uccafco/
>
>



-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy



More information about the Fortran mailing list