Have a look at
Proc::ProcessTable::Process, it might be of some help, although I have not used it to monitor memory usage. You use it from
Proc::ProcessTable, I've found it useful to keep the machine busy, but not too busy.
Edit: You get at your current process id (pid) whith the special
$PID variable, and then you can find that pid in the
Proc::ProcessTable
hth