Re: perl pad.c Assertion !((sv)->sv_flags & 0x00010000) failed
- From: Tim.Bunce@xxxxxxxxx (Tim Bunce)
- Date: Mon, 25 Jun 2007 21:44:02 +0100
On Fri, Jun 22, 2007 at 02:31:07PM +0200, demerphq wrote:
On 6/22/07, Peter Scott <Peter@xxxxxxxx> wrote:
On Thu, 21 Jun 2007 22:33:03 +0100, Tim Bunce wrote:
On Thu, Jun 21, 2007 at 06:47:11PM +0200, Rafael Garcia-Suarez wrote:
On 21/06/07, Steve Hay <steve.hay@xxxxxxxxxxxx> wrote:
I remember lots of discussion a while ago about constructions like "my
$x = 1 if $y;". I don't remember what the conclusion of it all was,
except that it's probably best avoided. Is that right?
Yes, that's right, because that could bypass initialisation of $x if
$y is false, leaving the previous value in it, like in state vars.
I thought that issue only related to a "compile-time constant false"
(such as the one in your example) and not to a runtime expression that
happened to be false sometimes.
Looking at it another way, are you saying that (ignoring closures)
subroutine scoped lexicals are not cleared when the subroutine exits,
but persist (consuming memory) until the subroutine is reentered?
$ ./perl -wle '$q = shift; sub foo { my $x if $q; print $x // $]; \
$x = 42 } foo; $q++; foo' 0
5.009005
42
It looks like it, no?
I didnt want to say anything right away in the hope that Dave Mitchell
would answer it, and in the knowledge i might have something wrong,
but I seem to recall Dave explaining once in the past that perl trys
to optimise allocation of memory so that it doesnt have to reallocate
buffers every time a sub is entered. So basically storage for SV's is
preserved between invocations when possible. But i dont remember the
details and I just might be totally ass-backwards wrong.
Once upon a time there was talk of implementing a "less" pragma
so you'd be able to say something like
use less qw(memory);
to indicate that cpu/memory balance should be shifted towards cpu.
Pity that never happened.
Tim.
.
- References:
- ANNOUNCE: DBI 1.57
- From: Tim Bunce
- Re: ANNOUNCE: DBI 1.57
- From: Steve Hay
- perl pad.c Assertion !((sv)->sv_flags & 0x00010000) failed (was: ANNOUNCE: DBI 1.57)
- From: Tim Bunce
- Re: perl pad.c Assertion !((sv)->sv_flags & 0x00010000) failed
- From: Steve Hay
- Re: perl pad.c Assertion !((sv)->sv_flags & 0x00010000) failed
- From: Tim Bunce
- Re: perl pad.c Assertion !((sv)->sv_flags & 0x00010000) failed
- From: Peter Scott
- ANNOUNCE: DBI 1.57
- Prev by Date: Is there a "Universal" access module?
- Next by Date: Error building DBD-ODBC on HPUX
- Previous by thread: Re: perl pad.c Assertion !((sv)->sv_flags & 0x00010000) failed
- Next by thread: Re: perl pad.c Assertion !((sv)->sv_flags & 0x00010000) failed
- Index(es):
Relevant Pages
|
|