[libmath-prime-util-perl] 06/50: Some changes for valgrind -- nothing big

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:45:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.13
in repository libmath-prime-util-perl.

commit f32a6de3dfa99a70664fad8dcd09ea02c87d93ae
Author: Dana Jacobsen <dana at acm.org>
Date:   Tue Jul 31 13:29:09 2012 -0600

    Some changes for valgrind -- nothing big
---
 Changes                |  1 +
 lib/Math/Prime/Util.pm | 13 +++++++++----
 t/81-bignum.t          |  6 ++++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Changes b/Changes
index 8a38333..25ac83c 100644
--- a/Changes
+++ b/Changes
@@ -7,6 +7,7 @@ Revision history for Perl extension Math::Prime::Util.
     - add prime_set_config(), including ability to set assume_rh to let all
       functions assume the Riemann Hypothesis.
     - Use the Schoenfeld bound for Pi(x) (x large) if assume_rh is true.
+    - valgrind testing
 
 0.11  23 July 2012
     - Turn off threading tests on Cygwin, as threads on some Cygwin platforms
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index e1b90a4..3bff7b5 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -52,7 +52,7 @@ my %_Config;
 BEGIN {
 
   # Load PP code.  Nothing exported.
-  require Math::Prime::Util::PP;
+  require Math::Prime::Util::PP;  Math::Prime::Util::PP->import();
 
   eval {
     require XSLoader;
@@ -547,9 +547,14 @@ sub primes {
 
     return random_nbit_prime($k) if $k <= $p0;
 
-    use Math::BigInt;
-    use Math::BigFloat;
-
+    eval {
+      require Math::BigInt;   Math::BigInt->import();
+      require Math::BigFloat; Math::BigFloat->import();
+      1;
+    } or do {
+      croak "Cannot load Math::BigInt and Math::BigFloat";
+    };
+    
     my $c = Math::BigFloat->new("0.09");  # higher = more trial divisions
     my $r = Math::BigFloat->new("0.5");
     my $m = 24;   # How much randomness we're trying to get at a time
diff --git a/t/81-bignum.t b/t/81-bignum.t
index 59523cf..dc3baf9 100644
--- a/t/81-bignum.t
+++ b/t/81-bignum.t
@@ -3,9 +3,11 @@ use strict;
 use warnings;
 
 # If you're not using ancient perl 5.6.2 with super early releases of bigint,
-# then you can define bigint up here and lose all the stupid quotes
-# around every number.
+# then you can define bigint up here and not have to quote every number.
 
+# Note: In 5.16.0 (and perhaps others?), using labels like "SKIP:" will create
+# a small memory leak.  So running the test suite through valgrind will show
+# some small leaks in this test, which has nothing to do with the module.
 
 my $extra = defined $ENV{RELEASE_TESTING} && $ENV{RELEASE_TESTING};
 my $broken64 = (18446744073709550592 == ~0);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list