You mentioned Determining memory usage of a process..., which lists a second answer (for Linux). This would work without installing additional modules. You simply have to find out wether your ps has different options.
I'm on Windows, and based on
Re^7: memory use array vs ref to array (or more probably
Re: time and mem usage of pgm by the
same author) I have scripts with
END {
system qq(tasklist /v /fo LIST /fi "PID eq $$")
}
and
END {
system qq(wmic PROCESS where "processid=$$" get * /FORMAT:LIST)
}
Perhaps one of these works for you?