>>>>> "SR" == Sheppy R <bobross...@gmail.com> writes:

  SR> Uri, how would you change the original code to get it to free up
  SR> memory?  I've run into this issue myself quite a few times.  I've
  SR> also seen perl consume an entire cpu core without even trying.
  SR> Could you rework the original scriptlet to show how you would free
  SR> the memory at the end or direct us to a resource that explains
  SR> this behavior so that we can have more efficient scripts?

perl cannot return ram to the OS. i said processes when do very special
memory management can do this but it is very rare. don't expect to even
try this as you can't from perl.

if you design your perl code well you shouldn't have memory leaks which
is the usual way to lose ram. other ways are just bad code that builds
up and up and never frees anything. you free stuff in perl indirectly
when the reference count hits zero.

freeing ram is just natural in perl if you declare things lexically in a
sub or block. when you leave the sub/block they will be freed back to
perl (not to the OS).

also consuming a cpu core is a cpu issue not a ram issue. it means
either your program is cpu bound (which is very possible) or you have an
infinite loop.

  SR> Often in the business world admins will see the resources that
  SR> perl is using and balk saying that it is taking up too many
  SR> resources.  I'd like to be able to minimize the footprint of my
  SR> scripts.

i can't help from a distance and without code. if you are serious, i can
consult with your place and help out that way. fixing ram issues is
usually not trivial nor something beginners know how to do. this is
beyond the scope of a beginner's list and i suggest you get professional
assistance (me in particular :).

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to