Re: [Boston.pm] perl 5.10 memory leak?

Ben Tilly <[email protected]>
Newsgroups gmane.comp.lang.perl.perl-mongers.boston
Message-ID <CANoac9Uxx9y+tS9X_tgFdAnYaOrSsZV1WbL6zTosjnXWytmWDg@mail.gmail.com>
This is nasty.  Does the following fix work for you?

use IO::All;
if ($^V lt v5.16.0) {
  no warnings 'redefine';
  my $orig_destroy = *IO::All::DESTROY{CODE};
  *IO::All::DESTROY = sub {
    my $self = shift;
    local $^V;
    $orig_destroy->($self, @_) if $orig_destroy;
  };
}

This temporarily replaces $^V with the empty string which does the right
thing with the current version check.  Hopefully your Perl gets upgraded
before IO::All has a new version check in DESTROY that this hack doesn't
work.

On Wed, Dec 14, 2016 at 7:44 AM, Duane Bronson <[email protected]>
wrote:

> Ahh - the bug is in universal.c
> <https://perl5.git.perl.org/perl.git/blobdiff/202e6ee2081e3a898537656cda1148d9aded394d..bcb2959f0:/universal.c> in
> XS_version_boolean.  Can I override that in perl code?  Something like this?
>
> sub version::boolean {
>   ...
> }
>
> Thanks, Matthew!  I'd like to know how you found that.  Google didn't help
> me.
> Duane
>
> On Dec 14, 2016, at 12:58 AM, Matthew Horsfall (alh) <[email protected]>
> wrote:
>
> On Wed, Dec 14, 2016 at 12:55 AM, Matthew Horsfall (alh)
> <[email protected]> wrote:
>
> On Tue, Dec 13, 2016 at 6:41 PM, Ben Tilly <[email protected]> wrote:
>
> Is the leak in not calling untie, or in looking at $^V?
>
>
> The leak is in looking at $^V. This was broken in 5.10.0 and fixed in
> 5.16.0.
>
>
> In boolean context.
>
>  my $x = $^V;  # fine
>  my $x = !$^V; # bad
>  if ($^V) { }       # bad
>
> -- Matthew Horsfall (alh)
>
>
>
>
> *Duane Bronson*
> [email protected]
> http://www.nerdlogic.com/
> 5 Goden St.
> Belmont, MA 02478
> 617.515.2909
>
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.