#!/usr/bin/perl -w use strict; use warnings; sub myfunc_1 { my $A = ''; vec($A, 20000000, 8) = 0; return $A; } sub myfunc_2 { vec($_[0], 100000000, 8) = 0; return 0; } $b = ; my $BIGSTRING = ''; myfunc_2($BIGSTRING); # memory usage is normal. $b = ; undef $BIGSTRING; # Pff! Gone from memory! TINYPERL.EXE memory # usage visibly shrinks in Windows Task Manager. $b = ; my $STRING2 = myfunc_1(); # memory usage is double! $b = ; undef $STRING2; # Deletes one copy only $b = ;