develooper Front page | perl.perl5.porters | Postings from November 2009

Re: [perl #67838] lvalue substr keeping lexical alive

Thread Previous | Thread Next
Eric Brine
November 10, 2009 12:56
Re: [perl #67838] lvalue substr keeping lexical alive
Message ID:
On Thu, Jul 23, 2009 at 7:19 PM, Kevin Ryde <>wrote:

> # New Ticket Created by  Kevin Ryde
> # Please include the string:  [perl #67838]
> # in the subject line of all future correspondence about this issue.
> # <URL: >

What's the impact of the bug?

substr, pos and vec operate on strings. Delaying the freeing of strings has
next to no impact. Problems can occur if the scalar containing the string is
then repurposed (e.g. to hold an object with a destructor), but the odds of
this occurring is probably next to nil.

keys operate on hashes. Delaying the freeing of a hash could have a
significant impact. On the other hand, lvalue keys is probably almost never

What's the impact of the fix?

Small slowdown due to the creation of a new SV for every lvalue call to
these ops

Our options at this time:

- Apply the provided patch, even though it will cause returning
substr/pos/vec/keys from an lvalue sub croaks.
- Apply an adjusted patch that doesn't fix the leak when substr/pos/vec/keys
are returned from an lvalue sub.
- Don't fix until a better solution is found.

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