> Perl has references, which are effectively pointers. Pointers and references are not the same in any way. Pointers allows for the direct acces of memory. Perl never gives you direct access. And that is why is doesn't leak outside of the one Caveot Tom Christianson wrote in the Camel Book.
> It has a garbage > collection system, which can be fooled. The simplest example of which > I'm aware which I know works in 5.6.1 is: > > sub leakit () { > my %foo; # 1 > $foo{bar} = \%foo; # 2 > return 0; > } # 3,4 And that is the useless documented example. Its a referece that refers to itself so the gargage collect never gets a zero reference count. > It's possible that 5.8.x has a fix for this method of leaking memory; I agree - its a bug in Perl. It's also a problem in coding way beyound memory leaks. It shows a fundemental lack of understanding the most basic priniciples of a flow chart. Such a code needs to have their drivers license suspended. > The best way to avoid this type of memory leak is to simply not have > circularly referenced data structures. Most people do this without even > trying. > > and last I knew, > mod-perl also did this Mod_perl is a C program, not a Perl Module. > (it had a leak in its reload code; it would not > free memory associated with any old versions of compiled subroutines. > This would only happen when apache received a HUP signal, and only if it > was set to reload its perl modules in response to such an event.) > Umm - to my knowledge, this is not a leak but it's defined behavor. Mod Perl CACHES objects. That's why it is so fast. > > A third way I've encountered, also only demonstrated in 5.6.1, is > through the use of eval, but the instance in which I encountered it was > convoluted enough that isolating the minimal requirement was not > feasible. I was able to verify that if I avoided the eval, I didn't > have the memory leak. Did you return a refernece to an object in the global namespace or USE an global variable in your object? That would do it. Ruben -- __________________________ Brooklyn Linux Solutions __________________________ DRM is THEFT - We are the STAKEHOLDERS http://fairuse.nylxs.com http://www.mrbrklyn.com - Consulting http://www.inns.net <-- Happy Clients http://www.nylxs.com - Leadership Development in Free Software http://www2.mrbrklyn.com/resources - Unpublished Archive or stories and articles from around the net http://www2.mrbrklyn.com/downtown.html - See the New Downtown Brooklyn.... 1-718-382-0585 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]