Example cylinder2d memory leaks


I just download Palabos today. And tried simply in showcase/cylinder2d

I did in the build folder:
cmake …
cd …/

then it gives me

No protocol specified
step 0; t=0; av energy =2.621108334e-05; av rho =0.9999999473
step 200; t=0.02; av energy =2.579491445e-05; av rho =0.9999993807
step 400; t=0.04; av energy =2.705754224e-05; av rho =1.000000404
step 600; t=0.06; av energy =2.721180303e-05; av rho =0.9999961278
step 800; t=0.08; av energy =2.75129395e-05; av rho =1.000249334

==776577==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6848 byte(s) in 3 object(s) allocated from:
#0 0x7f35ad43dbc8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
#1 0x7f35acb30702 in opal_free_list_grow_st (/usr/lib/x86_64-linux-gnu/libopen-pal.so.40+0x1f702)

I get the same error, any updates?

I am running the case on the cluster.

In general, the issue is occurring due to memory leaks within the code. Additionally, the developers of this code have added sanitizers and memory leak detectors to detect any memory leaks at runtime while running the code in “TEST” build mode. These memory leak detectors can be disabled during the compilation process by making a small change to the CMakeLists.txt file

To have a temporary fix for this solution, you can try the following steps:

  1. Once you run the cmake … command, check the output of CMake. For me, the below output was produced:

cache used.
ccache used.
Generated with config types:
Enabling MPI
Enabling POSIX
– Configuring done
– Generating done
– Build files have been written to: /home/gaurav/palabos/examples/showCases/cylinder2d/build

  1. As you can see in the above output, “Test” config mode is being used and the compiler used is Clang. This output can be different for your machine depending on whether your machine has GNU compilers or clang one.

  2. In the palabos/examples/showCases/cylinder2d folder, open CMakeLists.txt file. If the CMake output used Clang compiler, go to line 106 and modify this line
    set(CMAKE_CXX_FLAGS_TEST “-g -DPLB_DEBUG -DPLB_REGRESSION -O0 -fno-omit-frame-pointer -fsanitize=address”)



  1. Now modify the next line from
    set(CMAKE_CXX_LINKER_FLAGS_TEST “${CMAKE_CXX_LINKER_FLAGS_TEST} -fno-omit-frame-pointer -fsanitize=address”)



  1. With this modification, CMake won’t enable memory leak detectors in the Makefiles produced in the Test mode. Alternatively, to avoid above modifications, you could also simply use the Release config mode but this option still did not work for me for some reason.

  2. Once this modification is done, you can run the cmake … command and check for any issues.

  3. Run the make command.

  4. Since memory leak detectors are not enabled now, the simulation should succeed even with memory leaks within the code. This is a very hacky solution to just run the simulation somehow. A permanent solution can only be devised by developers of this code.

Please update if any issues occur. The above solution worked for me.