public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47637] New: Memory leak involving derived types w/ allocatable components
@ 2011-02-07 22:15 townsend at astro dot wisc.edu
  2011-02-08 20:16 ` [Bug fortran/47637] [OOP] Memory leak involving INTENT(OUT) CLASS argument " janus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: townsend at astro dot wisc.edu @ 2011-02-07 22:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47637

           Summary: Memory leak involving derived types w/ allocatable
                    components
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: townsend@astro.wisc.edu


Created attachment 23271
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23271
Source code plus makefile

The attached test-case code (Makefile included) compiles fine with gfortran 4.6
on Mac OSX 10.6. However, when I run the code I get a significant memory leak.
Valgrind reports:

==84427== LEAK SUMMARY:
==84427==    definitely lost: 38,496,000 bytes in 4,000 blocks
==84427==    indirectly lost: 0 bytes in 0 blocks
==84427==      possibly lost: 0 bytes in 0 blocks
==84427==    still reachable: 88 bytes in 1 blocks
==84427==         suppressed: 0 bytes in 0 blocks
==84427== Rerun with --leak-check=full to see details of leaked memory

The leaks are occurring with the st_l and st_r derived types in the evolve()
subroutine in hydro_evolve.f90; it seems that the allocatable components of
these variables are not being automatically deallocated when the recon()
subroutine is called, even though the corresponding dummy arguments in recon()
are declared as INTENT(out)..

If I uncomment the deallocate statements in evolve(), so that I do the
deallocation 'by hand', then the memory leak is fixed. So, a workaround is
possible, but this seems to be quite a fundamental bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-02-09 16:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 22:15 [Bug fortran/47637] New: Memory leak involving derived types w/ allocatable components townsend at astro dot wisc.edu
2011-02-08 20:16 ` [Bug fortran/47637] [OOP] Memory leak involving INTENT(OUT) CLASS argument " janus at gcc dot gnu.org
2011-02-08 22:51 ` janus at gcc dot gnu.org
2011-02-09 10:01 ` janus at gcc dot gnu.org
2011-02-09 14:10 ` burnus at gcc dot gnu.org
2011-02-09 16:01 ` janus at gcc dot gnu.org
2011-02-09 16:05 ` janus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).