How to trace down a memory leak in APE with valgrind
Given:
You already have a working/compiled APE server running and you still have the sources.
Rebuild (don’t use build.sh) with the following steps
Enter your APE source code directory and then do
cd deps/js/src/
./configure --enable-debug --enable-valgrind
make
cd ../../../
make
Now copy your rebuilt libape and aped to it’s default locations (see https://www.xosofox.de/2010/11/get-your-ape-up-to-date/)
Now run your ape with valgrind as a wrapper (I prefer to cd to /etc/ape so I don’t have to specify the ape.conf)
valgrind --leak-check=full --log-file=/path/to/mem.log /usr/bin/aped
pkill aped
All leaks will be written to the log and can be analyzed
Note: valgrind is slowing down the application dramatically in terms of CPU
(Thanks to Anthony @paraboul, all the information is coming from a chat with him)