Nicholas Clark wrote:
On Tue, Sep 06, 2005 at 07:01:06PM -0700, Chris Heath wrote:


Throwing an exception inside a grep sometimes causes Perl
to emit an internal warning.

$ perl -e 'for ("foo") { grep(die, "bar") }'
Died at -e line 1.
Attempt to free unreferenced scalar: SV 0x96c61dc, Perl interpreter: 0x96ae008.


The unreferenced scalar seems to be "bar" as this will still generate an error

$ perl -e 'grep {die} "bar" for undef'
Died at -e line 1.
Attempt to free unreferenced scalar: SV 0x800dd0.

(undef has special reference counting semantics)

Replacing grep with map produces the same error.


Does this warning indicate possible internal corruption?  I have seen
some Perl corruption in a production system at my work recently, as well
as this warning, so I wondered if they could be related.


Well, it's a double "free", in as much as one part of the interpreter has a
pointer to a block of memory that will be recycled as a new scalar at some
point. I'm not sure quite what route, or what manipulation of $@ could create
actual corruption though.

This bug is a dup of #24254, sometime ago I was able to trace it and to found its cause, not to solve it :-(

Attached to that bug report is a description of what is going on.

Cheers,

 - Salvador.

Reply via email to