public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/94361] New: Memory leak in nested types with final
@ 2020-03-27 16:46 antony at cosmologist dot info
  2020-05-18 19:11 ` [Bug fortran/94361] " anlauf at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: antony at cosmologist dot info @ 2020-03-27 16:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94361

            Bug ID: 94361
           Summary: Memory leak in nested types with final
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antony at cosmologist dot info
  Target Milestone: ---

The code below leaks memory (mem grows with each loop interation), but does not
if the "FINAL" is commented. The issue is also present in trunk (10.0.1
20200218), and may be a reduced test case for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109 (in which case the problem
was introduced around 8.3.1, but I have not tested versions extensively).


    module debug
    private

    Type TypeWithFinal
    contains
    FINAL :: finalizer  !No leak if this line is commented
    end type

    Type Tester
        real, dimension(:), allocatable :: Dat
        Type(TypeWithFinal) :: X
    end Type

    Type :: TestType2
        Type(Tester) :: T
    end type TestType2
    public Leaker
    contains

    subroutine Leaker
    type(TestType2) :: Test

    allocate(Test%T%Dat(100000000))
    end subroutine

    subroutine finalizer(this)
    Type(TypeWithFinal) :: this
    end subroutine finalizer

    end module


    program run
    use debug
    implicit none
    integer i

    do i=1, 10000
        call Leaker()
        call sleep(1)
    end do

    end program

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

end of thread, other threads:[~2020-06-01 18:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 16:46 [Bug fortran/94361] New: Memory leak in nested types with final antony at cosmologist dot info
2020-05-18 19:11 ` [Bug fortran/94361] " anlauf at gcc dot gnu.org
2020-05-18 19:12 ` anlauf at gcc dot gnu.org
2020-05-18 21:30 ` antony at cosmologist dot info
2020-05-19  9:15 ` antony at cosmologist dot info
2020-05-21 10:39 ` [Bug fortran/94361] [8/9/10/11 Regression] " anlauf at gcc dot gnu.org
2020-05-23 19:13 ` anlauf at gcc dot gnu.org
2020-05-24 12:26 ` tkoenig at gcc dot gnu.org
2020-05-31 10:00 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:16 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:33 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:49 ` cvs-commit at gcc dot gnu.org
2020-06-01 18:52 ` tkoenig 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).