From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21282 invoked by alias); 19 Jun 2011 15:40:01 -0000 Received: (qmail 21273 invoked by uid 22791); 19 Jun 2011 15:40:01 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 19 Jun 2011 15:39:47 +0000 From: "townsend at astro dot wisc.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/49466] Memory leak with assignment of extended derived types X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: townsend at astro dot wisc.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Sun, 19 Jun 2011 15:40:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg01682.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49466 --- Comment #2 from Rich Townsend 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 0x100000C27: MAIN__ (in ./evolve_aflow) ==32629== by 0x100000DA2: 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)