in reply to any way to control a memory leak

Are you pushing scalars on an array? Do you also re-use the array without letting it go out of scope inbetween?

Unless you also pop that array, you should 'empty' it.

$#my_array=-1;
(Been bitten there myself. ;-)

"Livet är hårt" sa bonden.
"Grymt" sa grisen...