MemoryLeak in Ensight-Postprocessing routine

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
Becker Ralf

MemoryLeak in Ensight-Postprocessing routine

Post by Becker Ralf »

Hello,

i noticed an issue with the Ensight postprocessing routines.

If the setting of NTCHR (periodicity of postprocessing) is such that the number of files exceeds 9999 code_saturne crashs.

It is likely that a memory block allocated by  malloc()  is written beyond the limits (see glibc() message below).

The last files are named *.110001; *.1110002; *.11110003; *.111110004 instead of *.10001; *10002; .. .

Kind regards,

Ralf Becker
----
*** glibc detected *** /home/beck_rf/tmp_Saturne/04061414/cs_solver: malloc():
memory corruption (fast): 0x0000000000d116f0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x7f3cffdf6d06]
/lib64/libc.so.6[0x7f3cffdfa5bd]
/lib64/libc.so.6(__libc_malloc+0x79)[0x7f3cffdfbae9]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libbft.so.1(bft_mem_malloc+0x6f)[0x7f3d01fc27df]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libbft.so.1(bft_file_open+0x43)[0x7f3d01fc1923]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libfvm.so.0(fvm_to_ensight_export_field+0x14f)[0x7f3d0299e54f]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libfvm.so.0(fvm_writer_export_field+0xb7)[0x7f3d029a8a07]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libsaturne.so.0(cs_post_write_var+0x16d)[0x7f3d02f0522d]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libsaturne.so.0(pstev1_+0x108)[0x7f3d02f08318]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libsaturne.so.0(psteva_+0x5b)[0x7f3d02f0b399]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libsaturne.so.0(dvvpst_+0x3c1)[0x7f3d02f36881]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libsaturne.so.0(pstvar_+0x1f34)[0x7f3d02f0a444]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libsaturne.so.0(caltri_+0x7e29)[0x7f3d02e27e09]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libsaturne.so.0(cs_run+0x7cb)[0x7f3d02e0045b]
/home/beck_rf/work/programme/2.0.0-beta2/cs-2.0-beta2/lib/libsaturne.so.0(main+0x1ed)[0x7f3d02e007dd]
----
Alexandre Douce

Re: MemoryLeak in Ensight-Postprocessing routine

Post by Alexandre Douce »

Hum, It seems to me that by default Code_Saturne is unable to handle more than 9999 records of time steps. We thought that it would be enough before a long time...
Yvan Fournier

Re: MemoryLeak in Ensight-Postprocessing routine

Post by Yvan Fournier »

Hello,

In FVM, in src/fvm_to_ensight_case.c you may modify "_add_var" you may replace "postfix_len = 5" by "postfix_len = 6" (line 414 in FVM 0.15.2), and a bit further (line 460), replace ".%04d" by "%05d" to go up to 99999 time steps.

Best regards,

    Yvan
Post Reply