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
Reduce memory needed for Data::Dumper #15716
Comments
From @bdracoThis is a bug report for perl from nick@cpanel.net, [Please describe your issue here] Please see attached patch |
From @bdraco0001-dist-Data-Dumper-Dumper.pm-Reduce-memory-usage-by-re.patchFrom 5350cea83c5386e16d5197652fb8bf0f1512dda7 Mon Sep 17 00:00:00 2001
From: "J. Nick Koston" <nick@cpanel.net>
Date: Mon, 14 Nov 2016 03:57:14 -0600
Subject: [PATCH] dist/Data-Dumper/Dumper.pm: Reduce memory usage by removing
overload and not importing Carp
---
dist/Data-Dumper/Changes | 5 +++++
dist/Data-Dumper/Dumper.pm | 21 ++++++++++-----------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/dist/Data-Dumper/Changes b/dist/Data-Dumper/Changes
index f9ea53f..ce5a57f 100644
--- a/dist/Data-Dumper/Changes
+++ b/dist/Data-Dumper/Changes
@@ -6,6 +6,11 @@ Changes - public release history for Data::Dumper
=over 8
+=item 2.162 (Nov 14 2016)
+
+Reduce memory usage by not importing from Carp
+Reduce memory usage by removing unused overload require.
+
=item 2.161 (Jul 11 2016)
Perl 5.12 fix/workaround until fixed PPPort release.
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm
index f461969..7afbd44 100644
--- a/dist/Data-Dumper/Dumper.pm
+++ b/dist/Data-Dumper/Dumper.pm
@@ -17,9 +17,8 @@ BEGIN {
use 5.006_001;
require Exporter;
-require overload;
-use Carp;
+use Carp ();
BEGIN {
@ISA = qw(Exporter);
@@ -70,7 +69,7 @@ $Maxrecurse = 1000 unless defined $Maxrecurse;
sub new {
my($c, $v, $n) = @_;
- croak "Usage: PACKAGE->new(ARRAYREF, [ARRAYREF])"
+ Carp::croak("Usage: PACKAGE->new(ARRAYREF, [ARRAYREF])")
unless (defined($v) && (ref($v) eq 'ARRAY'));
$n = [] unless (defined($n) && (ref($n) eq 'ARRAY'));
@@ -170,11 +169,11 @@ sub Seen {
$s->{seen}{$id} = [$k, $v];
}
else {
- carp "Only refs supported, ignoring non-ref item \$$k";
+ Carp::carp("Only refs supported, ignoring non-ref item \$$k");
}
}
else {
- carp "Value of ref must be defined; ignoring undefined item \$$k";
+ Carp::carp("Value of ref must be defined; ignoring undefined item \$$k");
}
}
return $s;
@@ -195,7 +194,7 @@ sub Values {
return $s;
}
else {
- croak "Argument to Values, if provided, must be array ref";
+ Carp::croak("Argument to Values, if provided, must be array ref");
}
}
else {
@@ -214,7 +213,7 @@ sub Names {
return $s;
}
else {
- croak "Argument to Names, if provided, must be array ref";
+ Carp::croak("Argument to Names, if provided, must be array ref");
}
}
else {
@@ -439,7 +438,7 @@ sub _dump {
if (ref($s->{sortkeys}) eq 'CODE') {
$keys = $s->{sortkeys}($val);
unless (ref($keys) eq 'ARRAY') {
- carp "Sortkeys subroutine did not return ARRAYREF";
+ Carp::carp("Sortkeys subroutine did not return ARRAYREF");
$keys = [];
}
}
@@ -492,11 +491,11 @@ sub _dump {
}
else {
$out .= 'sub { "DUMMY" }';
- carp "Encountered CODE ref, using dummy placeholder" if $s->{purity};
+ Carp::carp("Encountered CODE ref, using dummy placeholder") if $s->{purity};
}
}
else {
- croak "Can't handle '$realtype' type";
+ Carp::croak("Can't handle '$realtype' type");
}
if ($realpack and !$no_bless) { # we have a blessed ref
@@ -1472,7 +1471,7 @@ modify it under the same terms as Perl itself.
=head1 VERSION
-Version 2.162 (September 21 2016)
+Version 2.162 (November 14 2016)
=head1 SEE ALSO
--
2.10.2
|
From @bdracoPerl Info
|
From @jkeenanOn Mon, 14 Nov 2016 17:18:19 GMT, bdraco wrote:
In your patch there's a discrepancy between the version issuance dates listed in 'Changes': ##### ... and those listed in dist/Data-Dumper/Dumper.pm: ##### -Version 2.162 (September 21 2016) ##### Can you investigate? Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Mon, 14 Nov 2016 09:18:19 -0800, bdraco wrote:
Besides the version number issues Jim pointed out: - the patch appears to be against 5.24.1-RC, but should be against - the commit message subject is overlong with unusual spacing Tony |
From @bdracoI updated the Changes file to pull in the ones that had not been documented and bumped the version numbers. Please see attached. Thanks |
From @bdraco0001-dist-Data-Dumper-Dumper.pm-Reduce-memory-usage-by-re.patchFrom 4513801b24459ee388bba43d7b02c1ef8e5075db Mon Sep 17 00:00:00 2001
From: "J. Nick Koston" <nick@cpanel.net>
Date: Mon, 14 Nov 2016 03:57:14 -0600
Subject: [PATCH] dist/Data-Dumper/Dumper.pm: Reduce memory usage by removing
overload and not importing Carp
dist/Data-Dumper/Changes: Add missing Changes from git log
---
dist/Data-Dumper/Changes | 12 ++++++++++++
dist/Data-Dumper/Dumper.pm | 23 +++++++++++------------
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/dist/Data-Dumper/Changes b/dist/Data-Dumper/Changes
index f9ea53f..beeb25c 100644
--- a/dist/Data-Dumper/Changes
+++ b/dist/Data-Dumper/Changes
@@ -6,6 +6,18 @@ Changes - public release history for Data::Dumper
=over 8
+=item 2.163 (Nov 14 2016)
+
+Reduce memory usage by not importing from Carp
+
+Reduce memory usage by removing unused overload require.
+
+switch to using SvPVCLEAR()
+
+=item 2.162 (Sep 21 2016)
+
+Change sv_setpvn(..., "...", ...) to sv_setpvs(..., "...")
+
=item 2.161 (Jul 11 2016)
Perl 5.12 fix/workaround until fixed PPPort release.
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm
index f461969..865b90a 100644
--- a/dist/Data-Dumper/Dumper.pm
+++ b/dist/Data-Dumper/Dumper.pm
@@ -10,16 +10,15 @@
package Data::Dumper;
BEGIN {
- $VERSION = '2.162'; # Don't forget to set version and release
+ $VERSION = '2.163'; # Don't forget to set version and release
} # date in POD below!
#$| = 1;
use 5.006_001;
require Exporter;
-require overload;
-use Carp;
+use Carp ();
BEGIN {
@ISA = qw(Exporter);
@@ -70,7 +69,7 @@ $Maxrecurse = 1000 unless defined $Maxrecurse;
sub new {
my($c, $v, $n) = @_;
- croak "Usage: PACKAGE->new(ARRAYREF, [ARRAYREF])"
+ Carp::croak("Usage: PACKAGE->new(ARRAYREF, [ARRAYREF])")
unless (defined($v) && (ref($v) eq 'ARRAY'));
$n = [] unless (defined($n) && (ref($n) eq 'ARRAY'));
@@ -170,11 +169,11 @@ sub Seen {
$s->{seen}{$id} = [$k, $v];
}
else {
- carp "Only refs supported, ignoring non-ref item \$$k";
+ Carp::carp("Only refs supported, ignoring non-ref item \$$k");
}
}
else {
- carp "Value of ref must be defined; ignoring undefined item \$$k";
+ Carp::carp("Value of ref must be defined; ignoring undefined item \$$k");
}
}
return $s;
@@ -195,7 +194,7 @@ sub Values {
return $s;
}
else {
- croak "Argument to Values, if provided, must be array ref";
+ Carp::croak("Argument to Values, if provided, must be array ref");
}
}
else {
@@ -214,7 +213,7 @@ sub Names {
return $s;
}
else {
- croak "Argument to Names, if provided, must be array ref";
+ Carp::croak("Argument to Names, if provided, must be array ref");
}
}
else {
@@ -439,7 +438,7 @@ sub _dump {
if (ref($s->{sortkeys}) eq 'CODE') {
$keys = $s->{sortkeys}($val);
unless (ref($keys) eq 'ARRAY') {
- carp "Sortkeys subroutine did not return ARRAYREF";
+ Carp::carp("Sortkeys subroutine did not return ARRAYREF");
$keys = [];
}
}
@@ -492,11 +491,11 @@ sub _dump {
}
else {
$out .= 'sub { "DUMMY" }';
- carp "Encountered CODE ref, using dummy placeholder" if $s->{purity};
+ Carp::carp("Encountered CODE ref, using dummy placeholder") if $s->{purity};
}
}
else {
- croak "Can't handle '$realtype' type";
+ Carp::croak("Can't handle '$realtype' type");
}
if ($realpack and !$no_bless) { # we have a blessed ref
@@ -1472,7 +1471,7 @@ modify it under the same terms as Perl itself.
=head1 VERSION
-Version 2.162 (September 21 2016)
+Version 2.163 (November 14 2016)
=head1 SEE ALSO
--
2.10.2
|
From @bdraco
|
From @bdracoIs there a guide to how commit messages should be formatted? Thanks Sent from my Mobile
|
From @tonycozOn Wed, 16 Nov 2016 17:20:26 -0800, bdraco wrote:
https://github.com/Perl/perl5/blob/blead/pod/perlhack.pod#commit-message Your latest patch is still against maint, and needs to be against blead perl. Tony |
From @atoomicHere is the patch rebase on blead, which should apply cleanly for now On Wed, 16 Nov 2016 18:07:58 -0800, tonyc wrote:
|
From @atoomic0001-dist-Data-Dumper-Dumper.pm-Reduce-memory-usage-by-re.patchFrom 8339d4a35521e77a297804ee3282532ea38664f5 Mon Sep 17 00:00:00 2001
From: "J. Nick Koston" <nick@cpanel.net>
Date: Mon, 14 Nov 2016 03:57:14 -0600
Subject: [PATCH] dist/Data-Dumper/Dumper.pm: Reduce memory usage by removing
overload and not importing Carp
diff --git a/dist/Data-Dumper/Changes b/dist/Data-Dumper/Changes
index 9828fe0..728be78 100644
--- a/dist/Data-Dumper/Changes
+++ b/dist/Data-Dumper/Changes
@@ -11,6 +11,11 @@ Changes - public release history for Data::Dumper
The XS implementation now handles the C<Deparse> option, so using it no
longer forces use of the pure-Perl version.
+=item 2.162 (Nov 14 2016)
+
+Reduce memory usage by not importing from Carp
+Reduce memory usage by removing unused overload require.
+
=item 2.161 (Jul 11 2016)
Perl 5.12 fix/workaround until fixed PPPort release.
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm
index 8e3e4f1..6a96a61 100644
--- a/dist/Data-Dumper/Dumper.pm
+++ b/dist/Data-Dumper/Dumper.pm
@@ -17,9 +17,8 @@ BEGIN {
use 5.006_001;
require Exporter;
-require overload;
-use Carp;
+use Carp ();
BEGIN {
@ISA = qw(Exporter);
@@ -70,7 +69,7 @@ $Maxrecurse = 1000 unless defined $Maxrecurse;
sub new {
my($c, $v, $n) = @_;
- croak "Usage: PACKAGE->new(ARRAYREF, [ARRAYREF])"
+ Carp::croak("Usage: PACKAGE->new(ARRAYREF, [ARRAYREF])")
unless (defined($v) && (ref($v) eq 'ARRAY'));
$n = [] unless (defined($n) && (ref($n) eq 'ARRAY'));
@@ -170,11 +169,11 @@ sub Seen {
$s->{seen}{$id} = [$k, $v];
}
else {
- carp "Only refs supported, ignoring non-ref item \$$k";
+ Carp::carp("Only refs supported, ignoring non-ref item \$$k");
}
}
else {
- carp "Value of ref must be defined; ignoring undefined item \$$k";
+ Carp::carp("Value of ref must be defined; ignoring undefined item \$$k");
}
}
return $s;
@@ -195,7 +194,7 @@ sub Values {
return $s;
}
else {
- croak "Argument to Values, if provided, must be array ref";
+ Carp::croak("Argument to Values, if provided, must be array ref");
}
}
else {
@@ -214,7 +213,7 @@ sub Names {
return $s;
}
else {
- croak "Argument to Names, if provided, must be array ref";
+ Carp::croak("Argument to Names, if provided, must be array ref");
}
}
else {
@@ -438,7 +437,7 @@ sub _dump {
if (ref($s->{sortkeys}) eq 'CODE') {
$keys = $s->{sortkeys}($val);
unless (ref($keys) eq 'ARRAY') {
- carp "Sortkeys subroutine did not return ARRAYREF";
+ Carp::carp("Sortkeys subroutine did not return ARRAYREF");
$keys = [];
}
}
@@ -491,11 +490,11 @@ sub _dump {
}
else {
$out .= 'sub { "DUMMY" }';
- carp "Encountered CODE ref, using dummy placeholder" if $s->{purity};
+ Carp::carp("Encountered CODE ref, using dummy placeholder") if $s->{purity};
}
}
else {
- croak "Can't handle '$realtype' type";
+ Carp::croak("Can't handle '$realtype' type");
}
if ($realpack and !$no_bless) { # we have a blessed ref
@@ -1466,7 +1465,7 @@ modify it under the same terms as Perl itself.
=head1 VERSION
-Version 2.164 (November 12 2016)
+Version 2.164 (November 14 2016)
=head1 SEE ALSO
--
2.10.2
|
@tonycoz - Status changed from 'open' to 'pending release' |
From @bdracoThanks Tony
|
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#130101 (status was 'resolved')
Searchable as RT130101$
The text was updated successfully, but these errors were encountered: