The most pressing restriction when using more than one SICStus run-time in a process is that (on 32bit machines) all these run-times must compete for the the address-constrained range of virtual memory, typically the lower 256MB of memory.
This is worsened by the fact that, on some platforms, each SICStus run-time will attempt to grow its memory area as needed, leading to fragmentation. A fix that removes the restriction on useable memory is planned for a later release.
One way to avoid the fragmentation issue to some extent is to make each SICStus run-time preallocate a large enough memory area so it will not have to grow during run-time. This can be effected by setting the environment variables GLOBALSTKSIZE, PROLOGINITSIZE and PROLOGMAXSIZE.
On some platforms, currently Linux
and Windows, the default
bottom memory manager layer will pre-allocate as large a chunk of
address-constrained memory as possible when the SICStus run-time
is initialized. In order to use more than one run-time you therefore
should set the environment variable PROLOGMAXSIZE to limit this
greedy pre-allocation.
bash> GLOBALSTKSIZE=10MB; export GLOBALSTKSIZE; bash> PROLOGINITSIZE=20MB; export PROLOGINITSIZE; bash> PROLOGMAXSIZE=30MB; export PROLOGMAXSIZE;
You can use statistics/2
to try to determine suitable values for
thes, but it is bound to be a trial-and-error process.