Forking after using the array (regardless whether you
undef it first) only makes the problem worse, now you
have doubled the memory usage. Letting the parent die
just makes you back at the previous memory usage.
There is a "famous" trick, used by long running processes
to prevent possible memory leakage from sucking up all the
resources, but that doesn't use fork, it uses
exec. execing yourself means that
you are restarting yourself - starting with a fresh sheet
of memory. Obviously, this is not going to work for many
programs.
Abigail