I have an issue with memory management in various operating systems.
My program is a server that does some processing that could take a few GB of memory. After that,
I think the only reliable and portable way to do this is to spawn a spawn a new process to handle your request. Upon process exit the OS will reap all the associated memory.
Unfortunately you then have the inefficiencies related to spawning this process and inter-process communication (I note you're doing a lot of processing - I don't know if this implies that your inter-process communication has sizable data requirements). However you will get the memory behaviour you require. Note the OS shouldn't duplicate the memory consumed by the actual JVM, provided you spawn an identical JVM binary image.