# OLE Variant memory test use strict; use Win32::OLE::Variant; for my $i ( 0 .. 10000 ) { my $v = Win32::OLE::Variant->new(VT_ARRAY|VT_BSTR|VT_BYREF, [1,1000]); DoStuff(\$v); undef $v; } print STDERR "Waiting..."; # give time to watch process in Windoze Task Mangler sleep(5); print STDERR "Done.\n"; sub DoStuff { my $refVar = shift; # reference to the Variant for my $i ( 1 .. 1000 ) { $$refVar->Put($i, "Fred and barney are funny $i"); } } #### # OLE Variant memory test use strict; use Win32::OLE::Variant; for my $i ( 0 .. 0 ) { my $v = Win32::OLE::Variant->new(VT_ARRAY|VT_BSTR, [1,1000]); $v->Put(1, "not changed"); # Do something here to make $vr a separate variant that points to the data in $v my $vr = Win32::OLE::Variant->new(VT_ARRAY|VT_BSTR|VT_BYREF, $v); DoStuff(\$vr); # modify $vr and see if $v has changed printf "0x%04x, %s; 0x%04x, %s\n", $v->_RefType(), $v->Get(1), $vr->_RefType(), $vr->Get(1); undef $v; } print STDERR "Waiting..."; # give time to watch process in Windoze Task Mangler sleep(5); print STDERR "Done.\n"; sub DoStuff { my $refVar = shift; # reference to the Variant for my $i ( 1 .. 1000 ) { $$refVar->Put($i, "Fred and barney are funny $i"); } }