Hi,
I've done some investigation on our end but I need more info from you:
Your description worries me. You're saying that your server is crashing due to lack of memory. I'd like to learn more about exactly what is happening when you see this "crash".
Is your server swapping heavily and becoming unresponsive?
Is the Linux kernel OOM process killer killing a process for being too large?
How large are the Apache processes that are being killed?
Are you sure you don't have your server misconfigured to allow too many apache processes or threads for the amount of memory you have?
You jumped to the conclusion that Wordfence is not closing connections correctly and that is the cause of what you're describing as a memory leak in Apache or PHP. I'm not sure we can jump to this conclusion yet. The operating system is actually responsible for closing TCP connections to remote hosts (it sends the FIN or RST TCP flags), so tell me more about how you drew this conclusion please.
I'm going to make a leap of my own: Is it possible that you're not running out of memory and your server is not crashing. But instead all your apache threads or processes are busy because of a timeout condition when Wordfence is trying to establish a connection? So if you look at your mod_status page what you would see is all Apache processes stuck in the "W" or "Sending Reply" state?
It sounds like you're fairly technical so if you can reproduce the issue, please post the output of netstat, top and any kernel logs that may help us understand what's happening to your server. But make sure you sanitize any sensitive info before you do that.
Regards,
Mark.