in reply to Memory Leak Caused by Forking?

As a general rule, do not use the “flaming arrow approach” to anything.   When given a new request, don’t just “light another flaming arrow and shoot it into the air.”   Instead, you can spawn off one thread which sits on a queue and services the requests one at a time, sending the responses back on another queue.   If you want the application to be able to handle n requests in this way, spawn n children, all of them serving the same queue.   (n is a configurable parameter, and relatively small.   If the number of requests briefly or routinely exceeds the number of threads, the requests have to wait in line for a bit.)

The classic example is the fast-food burger joint.   When you order a burger, a new worker does not miraculously appear in a puff of orange smoke, serve your food, and then drop dead ...