http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49466
--- Comment #2 from Rich Townsend townsend at astro dot wisc.edu 2011-06-19
15:39:28 UTC ---
(In reply to comment #1)
(In reply to comment #0)
In the attached sample code, which is a reduced test case from the full
code,
the assignment as_b = as_a leaks memory from the U(:) allocatable
component
(which is defined in state_t, the parent type), but not from the W(:)
allocatable component (which is defined in astate_t).
Sorry, I'm not able to reproduce the memory leak with gfortran version 4.5 and
valgrind. Could you please tell me which gfortran version you use and how you
detect the memory leak?
This is 4.7.0 (svn) running on OS X 10.6.7. valgrind output:
==32629== Memcheck, a memory error detector
==32629== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==32629== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==32629== Command: ./evolve_aflow
==32629==
--32629-- ./evolve_aflow:
--32629-- dSYM directory is missing; consider using --dsymutil=yes
==32629==
==32629== HEAP SUMMARY:
==32629== in use at exit: 4,004,088 bytes in 1,002 blocks
==32629== total heap usage: 2,019 allocs, 1,017 frees, 8,012,001 bytes
allocated
==32629==
==32629== 3,996,000 bytes in 999 blocks are definitely lost in loss record 4 of
4
==32629==at 0x10001079F: malloc (vg_replace_malloc.c:236)
==32629==by 0x10C27: MAIN__ (in ./evolve_aflow)
==32629==by 0x10DA2: main (in ./evolve_aflow)
==32629==
==32629== LEAK SUMMARY:
==32629==definitely lost: 3,996,000 bytes in 999 blocks
==32629==indirectly lost: 0 bytes in 0 blocks
==32629== possibly lost: 0 bytes in 0 blocks
==32629==still reachable: 8,088 bytes in 3 blocks
==32629== suppressed: 0 bytes in 0 blocks
==32629== Reachable blocks (those to which a pointer was found) are not shown.
==32629== To see them, rerun with: --leak-check=full --show-reachable=yes
==32629==
==32629== For counts of detected and suppressed errors, rerun with: -v
==32629== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)