I added this when I didn't know much about programming. Actually the program doesn't optimise anything, it just calls the EmptyWorkingSet function against the running processes and from reading around, this can have an adverse affect on the running process. My advice, let Windows deal with memory management, this is what the kernel is designed for.BrewManNH from AutoIt
EmptyWorkingSet doesn't reduce the memory used, it just pages it to the hard drive, so it's an artificial reduction in memory. Calling it every 5 seconds is pointless, figure out where your memory leak is coming from before you start trying to find workarounds to bad code.
It's like you're building a house on mud, every day it sinks a little bit more unless you jack it up, you're not fixing the problem you're just fixing the symptom, the house is still sinking only you don't see that it's happening anymore. Out of sight out of mind is not good coding practice.