Perl Monk, Perl Meditation | |
PerlMonks |
Re^5: Catching errors in closing lexical filehandlesby tilly (Archbishop) |
on Sep 27, 2004 at 22:17 UTC ( [id://394377]=note: print w/replies, xml ) | Need Help?? |
Not to lessen your sense of wonderfulness, but there are problems with both true GC and reference counting. With true GC, variables going out of scope will eventually be freed. Open filehandles will be closed. etc. However when that will happen is another story. This is an issue when you're using some form of scarce resource. For instance the fact that some of your open filehandles will be closed someday does not help you if you've run over the local OS limit for open filehandles right now. Likewise leaking statement handles might make your database very unhappy. These are downsides to true GC. On the other hand reference counting isn't perfect either. First there is the obvious deficiency - circular references never go away. However there is also the hidden problem that it takes a lot of code distributed throughout your codebase to keep reference counts correct - and problems in that code are not that obvious. (Well, not if the bug is to add an extra 1 to the reference count...) This means that using reference counting increases the number of bugs in Perl. The upshot is that with true GC you want to close external resources yourself - because eventually may not come soon enough. With reference counting you have reliable timing, but it is really hard (read next to impossible) to get the implementation right.
In Section
Seekers of Perl Wisdom
|
|