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

Memory leak

qolin
Novice
3,512 Views

 

I have a memory leak. See attached example, which is an adapted portion of a much larger code.

This code (and the rest of the application) was doing everything with pointers. Over the past few months I have been replacing them all with allocatables, on the assumption that memory leaks are not possible with allocatables. ...Well clearly I was mistaken on that, so what am I doing wrong?

The leak occurs in copy_branch_plot_results, when it calls construct_branch_plot_results. In its original form with pointers, the code was a lot busier, with explicit tests all over to de-allocate the pointers where necessarry. I assumed this was not required with allocatables, so removed most of it, and was dismayed to find that my changes introduced leaks. 

Qolin

0 Kudos
26 Replies
Steven_L_Intel1
Employee
790 Views

Hmm - could have sworn I saw it say 0. But I see a non-zero value now. Will look closer.

0 Kudos
qolin
Novice
790 Views

Steve, any advance on this?

0 Kudos
Steven_L_Intel1
Employee
790 Views

Ok, finally got this sorted.

qolin, your original issue is one we're already working on - we found that it requires a static allocatable and a character component with a constant length to see. The compiled code is trying to deallocate the component but thinks it is already deallocated.

Ian's program shows a different problem, though there may be some relation. It has been escalated as DPD200253948.

0 Kudos
qolin
Novice
790 Views

Thanks Steve.

Please can I have the issue ID of this "one we're already working on " ?

Qolin

0 Kudos
Steven_L_Intel1
Employee
790 Views

DPD200253435

0 Kudos
Steven_L_Intel1
Employee
790 Views

DPD200253435 has been fixed for a release later this year. DPD200253948 is still being worked.

0 Kudos
Reply