[Bps-public-commit] r9995 - in Scalar-Defer: .

alexmv at bestpractical.com alexmv at bestpractical.com
Tue Dec 18 16:09:49 EST 2007


Author: alexmv
Date: Tue Dec 18 16:09:44 2007
New Revision: 9995

Modified:
   Scalar-Defer/   (props changed)
   Scalar-Defer/lib/Scalar/Defer.pm

Log:
 r25913 at zoq-fot-pik:  chmrr | 2007-12-18 16:08:36 -0500
  * Clean out the local storage when the InsideOut object goes away.
    Otherwise you leak memory like a sieve for every defer{} or lazy{}
    in your code.


Modified: Scalar-Defer/lib/Scalar/Defer.pm
==============================================================================
--- Scalar-Defer/lib/Scalar/Defer.pm	(original)
+++ Scalar-Defer/lib/Scalar/Defer.pm	Tue Dec 18 16:09:44 2007
@@ -34,6 +34,10 @@
         bless($obj => DEFER_PACKAGE);
     }
 
+    sub DEMOLISH {
+        delete $_defer{ id shift };
+    }
+
     use constant SUB_FORCE => sub ($) {
         no warnings 'uninitialized';
         &{
@@ -97,6 +101,7 @@
         }
 
         *DESTROY = \&Scalar::Defer::DESTROY;
+        *DESTROY = \&Scalar::Defer::DEMOLISH;
     }
 }
 



More information about the Bps-public-commit mailing list