To know how perl allocates memory, uses reference counts and such, read
perlguts and/or chapter 20 of
Advanced Perl Programming.
Nothing's perfect. Perl isn't either: perl doesn't free memory, it only reuses it.
I don't know if perl's memory usage can be limited using Perl - I always use ulimit (see: bash(1)) for that.
2;0 juerd@ouranos:~$ perl -e'undef christmas'
Segmentation fault
2;139 juerd@ouranos:~$