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

How to prevent the Heap memory from exhaust ?

Jack_S_
Beginner
641 Views

Hi all, 

Sorry if this is a side topic compared to this forum main scope, but I hope couple of us will benefit from it :

What is the best practice (in Fortran-90) to prevent the heap memory from exhaust (in Linux) ? In general, what is the best practice ''memory model'' when coding an average code (in complexity and size) in Fortran-90, are there any special guidelines ? For instance, I have read that using multiple times a subroutine which allocates / deallocates local arrays can exhaust the memory. I currently experience heap exhaustion in my code and I'm not sure how to tackle it.

Thanks in advance for your comments,

Jack. 

0 Kudos
2 Replies
Steven_L_Intel1
Employee
641 Views

If you use ALLOCATABLE and not POINTER, you should not have any memory leaks. This is by design in the language. You could use the memory growth tracking feature of Intel Inspector XE to see where allocations are coming from and if you have any leaks due to POINTERs.

Best practice is to use ALLOCATABLE.

0 Kudos
Jack_S_
Beginner
641 Views

Thank you Steve. 

Jack.

0 Kudos
Reply