develooper Front page | perl.perl5.porters | Postings from May 2006

Re: [perl #3306] DESTROY doesn't get called.

Thread Previous
Dave Mitchell
May 4, 2006 07:04
Re: [perl #3306] DESTROY doesn't get called.
Message ID:
On Tue, May 02, 2006 at 03:23:16AM +0300, Yuval Kogman wrote:
> On Mon, May 01, 2006 at 20:55:21 +0100, Dave Mitchell wrote:
> > > Oh... I was assuming if it were that way then the optimization would
> > > not be so substantial ;-)
> > 
> > I should imagine it's copying the scratchpad that takes most of the time.
> > Hmm, perhaps we could just share the scratchpads for non-closure anon
> > subs?
> Why is it copied? I guessed (in my prior email) that it's not
> captured vars, but just the sub proto and allocation info, right?
> In general the only runtime writable part of the scratch pad are the
> free variables... Perhaps closures should have the pad split up?

Every sub has its own scratchpad. The scratchpad contains pointers to:
* lexical vars
* captured outer lexical vars
* tmp SVs for OPs
* for threaded builds: assorted SVs that have been migrated from the OP
  tree since that is shared between threads.

The only exception to this are closureless anon subs which share the

The problem with splitting off the closure vars from the scratchpad in
order to avoid copying the scratchpad each time, is that it just
generalises the problems we have currently with sharing scratchpads of
closureless anon subs into a problem for all anon subs.

My get-up-and-go just got up and went.

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About