Just referencing the thread: [swi/prolog 8.2.1] : bugs on FreeBSD
I switched to tcmalloc when possible after observing an ever growing amount of wasted (freed and not reused) memory using ptmalloc on SWISH and the swi-prolog.org webserver. For more info see Poor memory reuse (tcmalloc?)