BUG: Foam::dlLibraryTable::open leaks memory
Detected using v1806 on the Linux Subsystem in Windows 10. My spontaneous guess is that the issue is the handling of the pointer declared on line 91 in the dlLibraryTable.C
void* ptr = dlOpen(fileName(libName).expand(), verbose);
Reproducing:
- Go to the channel395 tutorial. Run blockMesh. Set endTime to 0.2 to run 1 timeStep.
- Run
valgrind pimpleFoam
. Observe that you have a leak. - Add
enabled false;
to thefieldAverage
function object. NowlibFieldFunctionObjects.so
will not be loaded. Rerun and observe that there is no leak. - Add libs() to the
controlDict
and load either an existing library e.g.libOpenFOAM.so
or a nonexistentbanana.so
. - Run
valgrind --leak-check=full --show-leak-kinds=all pimpleFoam
. Observe a leak, and that things point todlOpen
.
Edited by Timofey Mukha