Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: reducing memory usage

by pg (Canon)
on Dec 17, 2002 at 04:20 UTC ( #220446=note: print w/replies, xml ) Need Help??

in reply to reducing memory usage

Two things might quickly increase memory usage:
  • Thread

    If your application is threaded, you would usually end up with using much more memory, as there are resources you would replicate for each thread. Especially for 5.8 thread, there are lots of memory leaks.

    To help measure threaded application, you may want download Benchmark::Thread::Size to help. This module is from CPAN. It reports memory usage for pieces of source code in a threaded application.
  • Circular ref and recursive call

    Recursive calls can increase memory usage very quickly.

    There is also something called circular ref, which causes memory leak in old versions of Perl. In old versions, circular ref can easily escape first phase of garbage collection. A sample would be:
    for (1..10000) { $var = \$var; }
    It seems that each instance of $var would be freed up at the end of each loop, but in old perl, that's not the case. All 10000 $var would exist up to the end of the execution.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://220446]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2019-09-22 07:59 GMT
Find Nodes?
    Voting Booth?
    The room is dark, and your next move is ...

    Results (273 votes). Check out past polls.