Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
A former college professor of mine and I were discussing memory leaks and garbage collection in various scripting languages the other day, and he asked me how this issue was handled in perl ...

You may already have background in this, though for the benefit of those reading on...

There are two principle approaches to memory management. One is to keep reference counts on objects, freeing the object when the count reaches zero. It's more work up front, but memory is freed promptly. One downside is that self-referential structures never reach zero reference counts, and hence are never freed. Perl5 uses this approach.

The second scheme is to periodically sweep through memory, tracing out objects that are reachable through known starting points (e.g., global variables, stack frames), and freeing anything that isn't reachable. There's ongoing overhead, but garbage collection can take noticeable time (though there are many clever optimizations that can make this approach run quickly). Self referential structures that are not otherwise reachable do get freed. Most Java implementations use this approach.


In reply to Re: Circular references and Garbage collection. by dws
in thread Circular references and Garbage collection. by DigitalKitty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-20 02:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found