==17629==ERROR: LeakSanitizer: detected memory leaks

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
claudio_ccpo
Posts: 6
Joined: Sun Feb 20, 2022 12:16 am
Location: Center for Coastal Physical Oceanography at Old D

==17629==ERROR: LeakSanitizer: detected memory leaks

#1 Unread post by claudio_ccpo »

Dear ROMS users, how r u?

I finished to run multiple times the upwelling example on a machine with Ubuntu 18.04.6 LTS, and notice that at the end on the screen the following message appears ==17629==ERROR: LeakSanitizer: detected memory leaks. Running ./romsG < roms_upwelling.in generate the 4 nc files, and there's not differences in the output nc files values running the same example in my old mac mini. There is any way to avoid that error? I appreciate any suggestion, Have a great day.




----------------------------------------------------------------------------------------------------------------------
1435 0001-01-05 23:35:00.00 5.835979E-04 1.663468E+04 1.663468E+04 3.339019E+13
(16,16,01) 9.286634E-03 2.160597E-03 2.251631E+00 5.322036E-01
1436 0001-01-05 23:40:00.00 5.842970E-04 1.663468E+04 1.663468E+04 3.339019E+13
(16,16,01) 9.288557E-03 2.159744E-03 2.251135E+00 5.324607E-01
1437 0001-01-05 23:45:00.00 5.849966E-04 1.663468E+04 1.663468E+04 3.339019E+13
(16,16,01) 9.290478E-03 2.158886E-03 2.250639E+00 5.327178E-01
1438 0001-01-05 23:50:00.00 5.856967E-04 1.663468E+04 1.663468E+04 3.339019E+13
(16,16,01) 9.292394E-03 2.158020E-03 2.250145E+00 5.329749E-01
1439 0001-01-05 23:55:00.00 5.863972E-04 1.663468E+04 1.663468E+04 3.339019E+13
(16,16,01) 9.294305E-03 2.157147E-03 2.249652E+00 5.332320E-01
1440 0001-01-06 00:00:00.00 5.870983E-04 1.663468E+04 1.663468E+04 3.339019E+13
(16,16,01) 9.296208E-03 2.156267E-03 2.249161E+00 5.334891E-01
WRT_HIS_NF90 - wrote history fields (Index=1,1) in record = 21
WRT_AVG_NF90 - wrote averaged fields in record = 20
WRT_DIAGS_NF90 - wrote diagnostics fields in record = 20
WRT_RST_NF90 - wrote re-start fields (Index=1,1) in record = 1

Elapsed wall CPU time for each process (seconds):

Thread # 0 CPU: 395.973
Total: 395.973

Nonlinear model elapsed CPU time profile, Grid: 01

Allocation and array initialization .............. 0.076 ( 0.0191 %)
Ocean state initialization ....................... 0.021 ( 0.0053 %)
Reading of input data ............................ 0.018 ( 0.0045 %)
Processing of input data ......................... 0.263 ( 0.0663 %)
Processing of output time averaged data .......... 102.248 (25.8220 %)
Computation of vertical boundary conditions ...... 0.288 ( 0.0726 %)
Computation of global information integrals ...... 2.581 ( 0.6517 %)
Writing of output data ........................... 0.254 ( 0.0643 %)
Model 2D kernel .................................. 183.219 (46.2705 %)
2D/3D coupling, vertical metrics ................. 1.836 ( 0.4637 %)
Omega vertical velocity .......................... 1.537 ( 0.3881 %)
Equation of state for seawater ................... 1.892 ( 0.4779 %)
3D equations right-side terms .................... 12.522 ( 3.1622 %)
3D equations predictor step ...................... 19.227 ( 4.8556 %)
Pressure gradient ................................ 6.702 ( 1.6924 %)
Harmonic mixing of tracers, S-surfaces ........... 4.067 ( 1.0270 %)
Harmonic stress tensor, S-surfaces ............... 6.742 ( 1.7027 %)
Corrector time-step for 3D momentum .............. 27.856 ( 7.0347 %)
Corrector time-step for tracers .................. 20.939 ( 5.2880 %)
Total: 392.286 99.0688 %

Unique kernel(s) regions profiled ................ 392.286 99.0688 %
Residual, non-profiled code ...................... 3.687 0.9312 %


All percentages are with respect to total time = 395.973


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Dynamic and Automatic memory (MB) usage for Grid 01: 18x18x15 tiling: 1x1

tile Dynamic Automatic USAGE

0 10.50 0.53 11.03

TOTAL 10.50 0.53 11.03

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

ROMS/TOMS - Output NetCDF summary for Grid 01:
number of time records written in HISTORY file = 21
number of time records written in RESTART file = 2
number of time records written in AVERAGE file = 20

Analytical header files used:

ROMS/Functionals/ana_btflux.h
ROMS/Functionals/ana_initial.h
ROMS/Functionals/ana_smflux.h
ROMS/Functionals/ana_stflux.h
ROMS/Functionals/ana_vmix.h

ROMS/TOMS: DONE... Tuesday - July 26, 2022 - 11:17:41 PM

=================================================================
==17629==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 12705792 byte(s) in 6204 object(s) allocated from:
#0 0x7f71ae738f30 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef30)
#1 0x560d4ecff514 in __yaml_parser_mod_MOD_yaml_assignstring /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/yaml_parser.f90:1600
#2 0x560d4ed14038 in __yaml_parser_mod_MOD_yaml_tree_fill /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/yaml_parser.f90:1058
#3 0x560d4ed35215 in __yaml_parser_mod_MOD_yaml_tree_create /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/yaml_parser.f90:493
#4 0x560d4ed3583f in __yaml_parser_mod_MOD_yaml_initialize /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/yaml_parser.f90:347
#5 0x560d4eb604c8 in __get_metadata_mod_MOD_io_metadata /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/get_metadata.f90:882
#6 0x560d4dd7752f in __mod_ncparam_MOD_initialize_ncparam /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/mod_ncparam.f90:1143
#7 0x560d4e9f3ce1 in read_phypar_ /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/read_phypar.f90:239
#8 0x560d4d6216cd in __inp_par_mod_MOD_inp_par /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/inp_par.f90:85
#9 0x560d4cd4c5c0 in __roms_kernel_mod_MOD_roms_initialize /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/roms_kernel.f90:86
#10 0x560d4cd4dbdf in myroms /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/master.f90:75
#11 0x560d4cd4e263 in main /home/cl4udio/ROMS/trunk/Projects/Grid_test/Build_romsG/master.f90:50
#12 0x7f71ac95fc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

User avatar
arango
Site Admin
Posts: 1368
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: ==17629==ERROR: LeakSanitizer: detected memory leaks

#2 Unread post by arango »

I bet that you are using gfortran? What version of the compiler? The YAML parser use features of Fortran2003 that gfortran has issues with them. I update the parser because of it. Have you updated your code to the latest version of ROMS?

claudio_ccpo
Posts: 6
Joined: Sun Feb 20, 2022 12:16 am
Location: Center for Coastal Physical Oceanography at Old D

Re: ==17629==ERROR: LeakSanitizer: detected memory leaks

#3 Unread post by claudio_ccpo »

Hello Arango, How r u? Yes, I'm using the latest version of ROMS, and the latest version of gfortran available in the UBUNTU library (sudo apt-get install gfortran) which is gfortran-7. In my old mac mini (2011) via homebrew ROMS run without problem with gfortran-11 and the latest version of ROMS. I tried to install gfortran-11 in Ubuntu without using the ubuntu repository, but a lot of errors appears during the compilation.

User avatar
arango
Site Admin
Posts: 1368
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Re: ==17629==ERROR: LeakSanitizer: detected memory leaks

#4 Unread post by arango »

We have many issues with gfortran in the GSW-Fortran (TEOS-10 equation of state) in JEDI. The problem is with various versions of gfortran implementing basic Fortran2003 functionality weirdly or incompletely. For example, the fact that you get memory leaks is a symptom of the problem and bug in the older compiler versions. In addition, there seems to be an issue with derived-type variables, structures, recursivity, CLASS (procedures inside structures), and explicit initialization of such objects. Moreover, different versions of gfortran have bugs. For example, gfortran is unable to execute the following statement in yaml_parser.F:

Code: Select all

   nkeys=COUNT((/ (string(i:i), i=1,Lstr) /) == token) + 1
It is a legal use of COUNT intrinsic function in the Fortran2003 standard, and gfortran gets in lots of trouble. So, I have to code my own function. Ridiculous!

I am not a fan of the gfortran compiler, and you get what you pay. I am afraid you need to update the compiler in your Linux system or use the ifort compiler. Nowadays, there are free versions of ifort.

claudio_ccpo
Posts: 6
Joined: Sun Feb 20, 2022 12:16 am
Location: Center for Coastal Physical Oceanography at Old D

Re: ==17629==ERROR: LeakSanitizer: detected memory leaks

#5 Unread post by claudio_ccpo »

Thank you for your response Arango. I upgrade the computer to the latest Ubuntu 22 LTS, the system was pre-loaded with gfortran-11. I just finishing to run the Up-welling example and the same ERROR appears in the terminal. Did that means that is not a problem of gfortran? Thanks for your time, take care.

claudio_ccpo
Posts: 6
Joined: Sun Feb 20, 2022 12:16 am
Location: Center for Coastal Physical Oceanography at Old D

Re: ==17629==ERROR: LeakSanitizer: detected memory leaks

#6 Unread post by claudio_ccpo »

I just solved the problem using the latest version of Ubuntu and ifort as a compiler. Thanks Arango.

Post Reply