[Israel.pm] Garbage Collection Question

semuel semuel at semuel.co.il
Mon May 10 14:25:56 PDT 2004


Hello There.

There is a difference between swapping to trashing.
Trashing is when the number of the active memory pages is greater then the
number of available physical memory pages, situation that causes the OS to
swap back-and-forth pages between the memory and disk, thus trashing.
But swapping itself is good. Not every page is under constant use, and it's
better to let sleeping demons lay. 
Well, that's the theory, in any case. 

Nighty Night.
Semuel.

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
Of Yuval Yaari
Sent: Monday, May 10, 2004 6:43 PM
To: Perl in Israel
Subject: Re: [Israel.pm] Garbage Collection Question

Isaac/Semuel, I think/hope that was sarcasm.

But yes, the only times I had to reboot my Linux box at work were 
because of the kernel swapping [1].
They were always hard reboots.
Never because of Perl though.
Getting MySQL to start swapping is easy, and if you put a too high 
MaxClients in your httpd.conf, apache could swap easily.
Just ab -c 10000 -n 10000000000 
http://localhost/very/cpu/and/memory/intensive/mod_perl/or/cgi/.

Once I'd give my computer some time after it started swapping, but with 
time, I learned to show mercy towards my computer, and just reboot.

To be honest, I'd rather see programs "crash", windows-style...

  --Yuval

[1] I'm not sure it was this machine but /sbin/modprobe didn't work one 
time after re-compiling my kernel so I rebooted.


Issac Goldstand wrote:

>AHHHHH!  You call that *positive*?!?  I'd rather a huge process in memory
>than in swap any day!  Swapping makes everything on the system run slower.
>
>  Yitzchak
>
>----- Original Message ----- 
>From: "semuel" <semuel at semuel.co.il>
>To: "'Perl in Israel'" <perl at perl.org.il>
>Sent: Monday, May 10, 2004 8:13 PM
>Subject: RE: [Israel.pm] Garbage Collection Question
>
>
>  
>
>>Hello There.
>>
>>
>>Why does everybody sees only the bad things?
>>Think positively: the unwanted allocated memory won't be accessed, and the
>>OS will eventually flash the inactive memory pages to the swap, where they
>>will sleep until the application will need that memory again.
>>No big deal.
>>
>>Semuel.
>>
>>
>>-----Original Message-----
>>From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf
>>Of Jason Elbaum
>>Sent: Sunday, May 09, 2004 11:45 AM
>>To: Perl in Israel
>>Subject: Re: [Israel.pm] Garbage Collection Question
>>
>>Yuval Yaari wrote:
>>
>>    
>>
>>>When that variable goes out of scope or is catched by the
>>>garbage fairy, Perl will not release that 1MB to the kernel right away,
>>>      
>>>
>it
>  
>
>>>will reuse it in case it needs it later on during execution."
>>>      
>>>
>>Many operating systems never really allow a process to return allocated
>>memory to the OS until the process exits. Processes can only grow, not
>>shrink. This may be due to an assumption that if a process once needed X
>>MB, it will probably need it again some time, and the churn by
>>repeatedly allocating and deallocating it to the process is more
>>expensive to the OS than just leaving it there.
>>
>>As a rule of thumb, you're better off not allocating massive data
>>structures unless you really need to access all the data at once.
>>
>>
>>Jason Elbaum
>>_______________________________________________
>>Perl mailing list
>>Perl at perl.org.il
>>http://www.perl.org.il/mailman/listinfo/perl
>>
>>
>>
>>_______________________________________________
>>Perl mailing list
>>Perl at perl.org.il
>>http://www.perl.org.il/mailman/listinfo/perl
>>
>>    
>>
>
>_______________________________________________
>Perl mailing list
>Perl at perl.org.il
>http://www.perl.org.il/mailman/listinfo/perl
>
>
>  
>

_______________________________________________
Perl mailing list
Perl at perl.org.il
http://www.perl.org.il/mailman/listinfo/perl






More information about the Perl mailing list