Front page | perl.perl5.porters |
Postings from March 2001
From: Gurusamy Sarathy
March 4, 2001 18:49
Message ID: 200103050249.f252nLo27942@smtp3.ActiveState.com
On Mon, 05 Mar 2001 01:31:51 GMT, Alan Burlison wrote:
>Can someone tell me what this is used for?
It is used for closure cloning.
Every CV that references lexicals from its outer lexical scopes needs
to be able to access that outer scope's scratchpad at run time (via
pp_anonsub(), cv_clone2() and pad_findlex()) to capture the lexicals
that are visible at the time the cloning happens. In fact, all CVs need
to have this whether they have outer lexicals referenced in them or
not, given that eval"" requires visibility of the outer lexical scopes.
The leak is coming from the fact that the anonymous CV prototype created
at compile time (and subsequently used for cloning at run time) is never
freed. I think eval"" and its variants should set up an array that
accumulates all new anonymous CV prototypes and clear this array after
the eval-ed text has finished running. I will attempt to implement
this if you don't feel up to it, let me know.
by Alan Burlison
by Gurusamy Sarathy