tcmalloc does not release memory properly to the OS for applications that allocate a large chunk of memory and then release it. The problem has been there for a long time.
This starves other applications running on the same machine, causing an out of memory error.
I tried changing TCMALLOC_RELEASE_RATE as described here, but the problem remains.
Is there a way to disable tcmalloc and use the regular malloc?
UPDATE: I rebuilt from scratch with
-DUSE_TCMALLOC=OFF, and now swipl releases the memory to the OS properly. I think this is a serious issue, since it can easily kill other applications that allocate and release large chunks of memory running on the same system. This is quite common for data science and big data applications which could die with an out of memory error. The problem is not noticed unless you have several big data applications which allocate and release large chunks of memory running on the same machine. For this reason, IMHO I would suggest to go back to the regular malloc, as this problem is very hard to track down and most users will not know what is going on. I am now building swipl from scratch with
-DUSE_TCMALLOC=OFF and skipping the distro build because of this issue.