[ET Trac] [Einstein Toolkit] #1519: Parameter parser leaks memory
Einstein Toolkit
trac-noreply at einsteintoolkit.org
Wed Jan 15 23:21:23 CST 2014
#1519: Parameter parser leaks memory
--------------------+-------------------------------------------------------
Reporter: rhaas | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: Cactus | Version: development version
Keywords: |
--------------------+-------------------------------------------------------
The function cctk_PirahaParser in src/piraha/Call.cc wraps each argument
to its set_function (points to CCTKi_SetParameter) in a strdup (with the
exception of ActiveThorns). This leads to a memory leak since
CTKi_SetParameter does not free() them. To test, run a minimal parfile
{{{
Cactus::cctk_itlast = 42
}}}
with an executable from an empty thornlist through valgrind:
{{{
valgrind --log-file=valgrind.log --leak-check=full --tool=memcheck
cactus_null answer.par
}}}
and you will find eg
{{{
==27121== 20 bytes in 1 blocks are definitely lost in loss record 297 of
1,362
==27121== at 0x4C2935B: malloc (vg_replace_malloc.c:270)
==27121== by 0x6249D91: strdup (strdup.c:42)
==27121== by 0x43D1C1: cctk_PirahaParser (Call.cc:875)
==27121== by 0x419855: CCTKi_ProcessParameterDatabase
(ProcessParameterDatabase.c:158)
==27121== by 0x416760: CCTKi_InitialiseCactus (InitialiseCactus.c:101)
==27121== by 0x415FFD: main (flesh.cc:64)
}}}
The attached patch fixes this. There is still some memory leakage (couple
hundred bytes that seem to be due to the flesh and persist even when the
old parser is reactivated).
--
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1519>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit
More information about the Trac
mailing list