Take a look at Safe::World
, where you can run your code inside a compartment than clean it from the memory. Also you can have many compartments as you want at the same time, each with different packages loades, or even assemble this compartments.
You also can try to make a different architecture in your application, where you can let some part of your application as a service in an unique process, so, the other process will access this service without load it, just making a call using any RPC protocol. So, take a look at SOAP.
About the prefork resource, is very nice if your OS has fork, but note that is not any module/code that can survive from a fork.
Graciliano M. P.
"Creativity is the expression of liberty".