public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/63640] New: move_alloc memory leak
@ 2014-10-24 19:53 patnel97269-gfortran at yahoo dot fr
  2014-11-04  9:00 ` [Bug fortran/63640] " Joost.VandeVondele at mat dot ethz.ch
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: patnel97269-gfortran at yahoo dot fr @ 2014-10-24 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63640
           Summary: move_alloc memory leak
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patnel97269-gfortran at yahoo dot fr

Hi, 

The move_alloc intrisic has a memory leak, the object "from" doesn't seems to
be deallocated. Here is a small test case with integer, but leaks also for dp.

I'm using version 4.9.1 .

Thanks. 

program testmv3
  type bar
    integer, allocatable  :: ia(:), ja(:)
  end type

  integer, allocatable  :: ia(:), ja(:)
  type(bar), allocatable :: sm,sm2

  allocate(sm)
  allocate(sm2)
  allocate(sm%ia(100),sm%ja(100))
  allocate(sm2%ia(1000),sm2%ja(1000))
  allocate(ia(100),ja(1000))

  call move_alloc(ja,ia)
  call move_alloc(sm%ia,sm2%ia)

  call move_alloc(sm%ja,sm2%ja)

end program testmv3



==5438== HEAP SUMMARY:
==5438==     in use at exit: 4,992 bytes in 5 blocks
==5438==   total heap usage: 29 allocs, 24 frees, 25,211 bytes allocated
==5438== 
==5438== 96 bytes in 1 blocks are definitely lost in loss record 1 of 5
==5438==    at 0x4C29F90: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5438==    by 0x40089A: MAIN__ (test_memleak.f90:9)
==5438==    by 0x400F66: main (test_memleak.f90:20)
==5438== 
==5438== 896 (96 direct, 800 indirect) bytes in 1 blocks are definitely lost in
loss record 4 of 5
==5438==    at 0x4C29F90: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5438==    by 0x4009A1: MAIN__ (test_memleak.f90:10)
==5438==    by 0x400F66: main (test_memleak.f90:20)
==5438== 
==5438== 4,000 bytes in 1 blocks are definitely lost in loss record 5 of 5
==5438==    at 0x4C29F90: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5438==    by 0x400DD7: MAIN__ (test_memleak.f90:13)
==5438==    by 0x400F66: main (test_memleak.f90:20)
==5438== 
==5438== LEAK SUMMARY:
==5438==    definitely lost: 4,192 bytes in 3 blocks
==5438==    indirectly lost: 800 bytes in 2 blocks
==5438==      possibly lost: 0 bytes in 0 blocks
==5438==    still reachable: 0 bytes in 0 blocks
==5438==         suppressed: 0 bytes in 0 blocks


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

end of thread, other threads:[~2014-12-23 14:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-24 19:53 [Bug fortran/63640] New: move_alloc memory leak patnel97269-gfortran at yahoo dot fr
2014-11-04  9:00 ` [Bug fortran/63640] " Joost.VandeVondele at mat dot ethz.ch
2014-11-04 16:46 ` patnel97269-gfortran at yahoo dot fr
2014-11-05 15:52 ` patnel97269-gfortran at yahoo dot fr
2014-12-09 19:57 ` dominiq at lps dot ens.fr
2014-12-09 20:14 ` Joost.VandeVondele at mat dot ethz.ch
2014-12-23 14:58 ` mikael 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).