This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: deallocating derived type arrays with allocatable components


Chris Talley wrote:
I have a derived type array that contains allocatable components. If I
deallocate the derived type array, does gfortran deallocate the
allocatable components for me or do I have to deallocate them myself
prior to deallocating the derived type array. Currently, I am
currently using gcc4.2.0-20070307.
Thanks for your help!

They are automatically deallocated for you. This is a requirement of the Fortran standard regarding allocatable components (and is one of the reasons why allocatable components didn't appear in GFortran until version 4.2; it took a fair bit of work to get it all right).


In general, you can work from the axiom that it is never possible to leak memory using allocatable arrays and components.

(Note that this is not true of derived types with pointer components, however.)

- Brooks


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]