Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

deallocate all

mariospapa
Beginner
1,565 Views
Is there any intrinsic statement in fortran90 to deallocate all allocatable matrices at once? Something like Deallocate (ALL).... Or i have to deallocate them one by one?
0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
1,565 Views

On Windows, when an application ends, the effect is the same.

This applies to memory obtained by way of ALLOCATE in Fortran malloc/new in C/C++ (assuming non-overloaded malloc/new). On C++, the dtor would be bypassed, but the bulk memory would be returned.

You should get into the habbit of matching DEALLOCATEs with ALLOCATEs.

Jim

0 Kudos
Steven_L_Intel1
Employee
1,565 Views
Also, if you declare ALLOCATABLE arrays local to a procedure, and have not marked them SAVE, they will be automatically deallocated when the procedure returns.
0 Kudos
mariospapa
Beginner
1,565 Views
I'm using QuickWin features and i want to open input files consecutively from my File ---> Open menu that i have created in the QuickWin application. When i load the first file the program runs until the end... When I load the second file it says "fortrtl (151) severe: Allocatable array is already allocated" and stops! How can i avoid this without closing my QuickWin application?

PS. I haven't marked as "save" the allocatable arrays inside my procedures...
0 Kudos
bmchenry
New Contributor II
1,565 Views
be sure to also check your Project/default properties.
project properties->Fortran->Data->Local variable Storage
Default Local Storage
/Qsave - all Variable SAVE)
/Qauto_scalar - scalarLocal Variable AUTOMATIC
/Qauto - Local Variables AUTOMATIC
0 Kudos
Reply