One possible way to return memory to the system is starting
a new process, using
exec or
Win32::Process. This
is only valid if your program will be sleeping for long
periods of time (at least maybe 5 minutes or more). This
way you can upon finishing running, start a new process from
the same executable, with a clean memory usage which will
not expand until you
require the desired modules. Make
sure you do use
require and not
use so they won't be
loaded at compile time. This probably isn't what you are
looking for, but I thought I'd mention it anyway.