New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] fix memory leak in B::RHE #15794
Comments
From @dur-randirCreated by @dur-randirFixes memory leak in B::RHE->HASH. This was exposed by B::Deparse Perl Info
|
From @dur-randir0001-Fix-memory-leak-in-B-RHE-HASH-method.patchFrom 70a2d7c5d1d0b354e514b169b47cf3b968e92bf9 Mon Sep 17 00:00:00 2001
From: Sergey Aleynikov <sergey.aleynikov@gmail.com>
Date: Thu, 5 Jan 2017 01:33:32 +0300
Subject: [PATCH] Fix memory leak in B::RHE->HASH method.
---
ext/B/B.pm | 2 +-
ext/B/B.xs | 2 +-
t/op/svleak.t | 12 +++++++++++-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ext/B/B.pm b/ext/B/B.pm
index e0f9e21..9e58700 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -15,7 +15,7 @@ require Exporter;
# walkoptree comes from B.xs
BEGIN {
- $B::VERSION = '1.65';
+ $B::VERSION = '1.66';
@B::EXPORT_OK = ();
# Our BOOT code needs $VERSION set, and will append to @EXPORT_OK.
diff --git a/ext/B/B.xs b/ext/B/B.xs
index 2279f36..bb95a3b 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -2214,7 +2214,7 @@ SV*
HASH(h)
B::RHE h
CODE:
- RETVAL = newRV( (SV*)cophh_2hv(h, 0) );
+ RETVAL = newRV_noinc( (SV*)cophh_2hv(h, 0) );
OUTPUT:
RETVAL
diff --git a/t/op/svleak.t b/t/op/svleak.t
index 77ff9ae..b949e44 100644
--- a/t/op/svleak.t
+++ b/t/op/svleak.t
@@ -15,7 +15,7 @@ BEGIN {
use Config;
-plan tests => 138;
+plan tests => 139;
# run some code N times. If the number of SVs at the end of loop N is
# greater than (N-1)*delta at the end of loop 1, we've got a leak
@@ -560,3 +560,13 @@ EOF
sub f { $a =~ /[^.]+$b/; }
::leak(2, 0, \&f, q{use re 'strict' shouldn't leak warning strings});
}
+
+# check that B::RHE->HASH does not leak
+{
+ package BHINT;
+ sub foo {}
+ require B;
+ my $op = B::svref_2object(\&foo)->ROOT->first;
+ sub lk { { my $d = $op->hints_hash->HASH } }
+ ::leak(3, 0, \&lk, q!B::RHE->HASH shoudln't leak!);
+}
--
2.10.2
|
From @jkeenanOn Wed, 04 Jan 2017 22:56:19 GMT, randir wrote:
Smoke-testing in branch: smoke-me/jkeenan/130504-B -- |
The RT System itself - Status changed from 'new' to 'open' |
From @LeontOn Wed, Jan 4, 2017 at 11:56 PM, Sergey Aleynikov <perlbug-followup@perl.org
This change looks correct to me. Leon |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been Perl 5.26.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#130504 (status was 'resolved')
Searchable as RT130504$
The text was updated successfully, but these errors were encountered: