Quantcast
Channel: Intel® Software - Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2746

class(*) pointer memory usage

$
0
0

Hi,

I just discovered that when using a class(*) pointer in a code, the intel compiler 15.0.2 or 16b  use almost 6 times more bytes than gfortran. if the class(*) pointer is removed then the memory allocation looks correct. Any reason/ideas for that behavior ?  (In the code below in the usage not the leaks of the pointer i do not deallocate).

Thanks

program toto
implicit none

type t
        type(t),pointer :: tp

        class(*),pointer :: val ! comment this and the bytes usage is the same.
end type

integer :: i,n
type(t),pointer :: m
type(t),allocatable , dimension(:) :: tab

n=100000

allocate(tab(n))

do i=1,n
allocate(m)
!m%i=90
tab(i)%tp => m
m=>null()
end do

end program toto

 

 

 ifort main2.f90
 valgrind ./a.out
==14216== Memcheck, a memory error detector
==14216== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==14216== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==14216== Command: ./a.out
==14216==
==14216==
==14216== HEAP SUMMARY:
==14216==     in use at exit: 27,200,032 bytes in 100,002 blocks
==14216==   total heap usage: 100,003 allocs, 1 frees, 27,200,048 bytes allocated
==14216==


gfortran  main2.f90
valgrind ./a.out
==14224== Memcheck, a memory error detector
==14224== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==14224== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==14224== Command: ./a.out
==14224==
==14224==
==14224== HEAP SUMMARY:
==14224==     in use at exit: 4,800,000 bytes in 100,001 blocks
==14224==   total heap usage: 100,024 allocs, 23 frees, 4,812,324 bytes allocated

 


Viewing all articles
Browse latest Browse all 2746

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>