What's really sad is that GC algorithms are very well known and quite easy to use; the Boehm GC comes to mind immediately.
What you're missing from this analysis is that swapping to mark & sweep GC, particularly a conservative GC such as Boehm, means that you no longer have any guarantee of the timing of destruction of objects, or even that they'll be (formally) destroyed at all, before program exit. So many of the existing uses of DESTROY in Perl would go out of the window, and the paradigm of Resource Acquisition Is Initialization would no longer be possible. Files handles wouldn't close automatically when the go out of scope. Database handles wouldn't be released immediately that their enclosing object becomes unreferenced. If the system has a lot of free memory, it's quite possible that the GC decides that it doesn't need to run a sweep, with the result that the program runs out of a limited resource such as database handles.
Hence it's easy to do something "obvious" and get it very wrong.
What would be needed is code to detect cycles of references, which is something more subtle than general "live-ness".
And as Andy suggests, nothing is stopping you contributing patches to Perl 5 to implement this. You can get the source code from http://perl5.git.perl.org/perl.git
Read More