You can try memory management yourself and see that the memory allocated
is not wiped until the script is finished.

--------------------8<--------------------
#!/usr/bin/perl

&bla();
print "Done";

sub bla {
   my $var = "";
   for( 1 .. 10_000_000  ) {
      $var .= "xxx";
   }

   my $bla = <STDIN>;
   undef $var;
}
--------------------8<--------------------

You can modify this example to use threads and see what's happeing to
your memory.

Tom


Foo Ji-Haw wrote:
> Hello Carl,
> 
>>
>> Nope that's right, so you load up one image. The perl process
>> allocates itself 100MB of memory for it from the OS. Then doesn't
>> release it back to the OS once it's finished with.
>>
>> The perl process will re-use this memory, so if you process another
>> image you don't grab another 100MB, it's just not available at the OS
>> level or for other processes.
>>
>> This isn't completely bad as long as your OS has good memory
>> management. The unused memory in the perl process will just be swapped
>> out to disk and left there until that process uses it again or exits.
> 
> Can I confirm that in the Windows implementation, if a thread allocates
> requires 100MB of memory and then releases it, the next thread can reuse
> that memory?
> 
> Thanks.
> 
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to