Striker1440 has asked for the wisdom of the Perl Monks concerning the following question:
Testing this using Perl 26 / 30 the code snippet leaks showing:use strict; use warnings; use Devel::Leak; my $string = "TESTING STRING"; my $count = Devel::Leak::NoteSV (my $handle); print ($string =~ s/\ STRING//); undef $string; Devel::Leak::CheckSV ($handle);
Testing with Perl 16, this does not leak.new 0x55fd7b6db1e0 : SV = PV(0x55fd7b6dbe60) at 0x55fd7b6db1e0 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x55fd7b713c00 "TESTING STRING"\0 CUR = 14 LEN = 16 COW_REFCNT = 1
use strict; use warnings; use Devel::Leak; my $string = "TESTING STRING"; my $count = Devel::Leak::NoteSV (my $handle); print ($string =~ s/\ STRING//); undef $string; Devel::Leak::CheckSV ($handle);
new 0x561fa5f971e0 : SV = PV(0x561fa5f97e60) at 0x561fa5f971e0 REFCNT = 1 FLAGS = (POK,IsCOW,pPOK) PV = 0x561fa5fc6320 "TESTING STRING"\0 CUR = 14 LEN = 16 COW_REFCNT = 1
To me this indicates that the CPAN module is "broken" it indicates a leak as noted by the "new 000000000072a728 :" section, but does not print the "debug" information associated with the SV that is being kept. If I switch from the CPAN module back to the APT version I get the full trace of information associated with the SV as previously noted. Thoughts?1 new 000000000072a728 :
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex replace leaking memory.
by dave_the_m (Monsignor) on Aug 25, 2020 at 08:12 UTC | |
|
Re: Regex replace leaking memory.
by swl (Prior) on Aug 25, 2020 at 04:56 UTC | |
by Striker1440 (Sexton) on Aug 25, 2020 at 05:26 UTC | |
by swl (Prior) on Aug 25, 2020 at 06:30 UTC | |
by swl (Prior) on Aug 25, 2020 at 07:03 UTC | |
|
Re: Regex replace leaking memory.
by kcott (Archbishop) on Aug 25, 2020 at 08:37 UTC | |
|
Re: Regex replace leaking memory.
by swl (Prior) on Aug 25, 2020 at 22:26 UTC | |
|
Re: Regex replace leaking memory.
by k-mx (Scribe) on Aug 30, 2020 at 12:33 UTC |