ProcessBuilder.start and Runtime.exec seem to use fork() on *NIX system, which seems to allocate the child process the same amount of memory as the parent process (see e.g. this question ). This can be painful if you want to launch a process which needs almost no memory from a process that uses lots of memory.
Is there any way to launch processes using POSIX_SPAWN -- which doesn't do this memory allocation? The only way I know of is using Tanuki, but turns out to be not ideal for me.
Use the NuProcess library. It uses VFORK on Linux which does not copy the process space first, thereby eliminating the frequent OOM errors when forking processes from a java process with a large heap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With