This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove 'hfreeentries failed to free hash' panic
authorDavid Mitchell <davem@iabyn.com>
Tue, 10 May 2011 16:24:29 +0000 (17:24 +0100)
committerDavid Mitchell <davem@iabyn.com>
Thu, 19 May 2011 13:49:43 +0000 (14:49 +0100)
commitee872193302939c724fd6c2c18071c621bfac6c4
tree9649f1d0a1d70dd68afd4642f6b90f78fb405ff0
parent272e8453abcb0fceb34b1464670386e03a1f55bb
remove 'hfreeentries failed to free hash' panic

Currently perl attempts to clear a hash 100 times before panicking.
So for example, if a naughty destructor keeps adding things back into the
hash, this will eventually panic.

Note that this can usually only occur with %h=() or undef(%h), since
when freeing a hash, there's usually no reference to the hash that a
destructor can use to mess with the hash.

Remove this limit (so it may potentially loop forever).

My reasoning is that (a) if the user wants to keep adding things back into
the hash, who are we to stop her? (b) as part of of the process of making
sv_clear() non-recursive when freeing hashes, I'm trying to reduce the
amount of state that must be maintained between each iteration.

Note that arrays currently don't have a limit.
hv.c
pod/perldiag.pod