Groups | Search | Server Info | Login | Register


Groups > perl.perl5.changes > #34443

[Perl/perl5] 3ed243: Add SAVEt_PADSV; fixes memory leak in pp_methstart

Newsgroups perl.perl5.changes
Date 2026-03-09 05:30 -0700
Message-ID <Perl/perl5/push/refs/heads/blead/1aa643-3ed243@github.com> (permalink)
Subject [Perl/perl5] 3ed243: Add SAVEt_PADSV; fixes memory leak in pp_methstart
From perl5-changes@perl.org (Paul Evans via perl5-changes)

Show all headers | View raw


  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 3ed2439bc15f60b2ab82a0f91b568a32f9c8bd7d
      https://github.com/Perl/perl5/commit/3ed2439bc15f60b2ab82a0f91b568a32f9c8bd7d
  Author: Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
  Date:   2026-03-09 (Mon, 09 Mar 2026)

  Changed paths:
    M class.c
    M embed.fnc
    M embed.h
    M proto.h
    M regen/embed.pl
    M regen/scope_types.pl
    M scope.c
    M scope_types.h
    M sv.c
    M t/class/field.t

  Log Message:
  -----------
  Add SAVEt_PADSV; fixes memory leak in pp_methstart

The previous commit here (6b450442) intended to fix `pp_methstart` to
allow refaliasing operations on fields. The way it did this had the
unintended side-effect of no longer undoing the `SvREFCNT_inc` applied
to each field, and thus caused every method call to leak SV references
to every field it captured.

This change fixes this, by introducing a new savestack operation,
`SAVEt_PADSV`. This operation saves the current SV in a pad slot, then
on scope exit restores it back by first decrementing the reference count
of *whatever SV* is now found in that pad slot. This was the original
bug in `pp_methstart` that refaliasing into fields highlighted and the
previous commit intended to fix.

In addition to the bugfix, this new savestack operation makes it more
efficient than the previous code, as it combines into a single operation
the two behaviours which previously required two separate ones
(SAVEt_SPTR + SAVEt_CLEARSV).



To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications

Back to perl.perl5.changes | Previous | Next | Find similar


Thread

[Perl/perl5] 3ed243: Add SAVEt_PADSV; fixes memory leak in pp_methstart perl5-changes@perl.org (Paul Evans via perl5-changes) - 2026-03-09 05:30 -0700

csiph-web