metno / snap

Severe Nuclear Accident Programme
GNU General Public License v3.0
23 stars 6 forks source link

Memory leakage when compiling with Intel compiler #92

Closed heikoklein closed 2 years ago

heikoklein commented 2 years ago

When compiling snap with the intel compiler (2018, but also reported for other versions) snap will give a segmentation fault while reading meteorology unless the code has been compiled with the -heap-arrays compiler option. This is strange since most (all) arrays in SNAP are dynamically allocated anyway.

For a standard test-run (2day forecast), SNAP compiled with gcc requires 3GB which are allocated early in the program. When compiling with ifort -heap-arrays, SNAP starts at 3GB but grows during the 2day forecast run to a memory consumption larger than 8GB. This looks like a clear case of a memory leakage.

Tested on both linux (rh8, ifort 2018) and windows.

heikoklein commented 2 years ago

Looking at the segmentation-faults with a debugger, ifort seams to allocate all associated fields on the stack, which isn't large enough for the snap fields. And associate with -heap-arrays seams to lead to the memory-leaks. To be continued...