Looks like I've got a slightly different version:

perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x +86-multi-thread

uname -a didn't give me anything. I don't know what I did wrong

Do you want to know what leaktest -verbose has to say? If there's a way to copy/paste it rather than type it by hand it would be great to know...

What sort of values are assigned to $rep
In this question & in testing I use small values (like <100) just to see how well it works. Once it's polished I want to use numbers basically a big as my computer can handle, like 1000 or bigger. So I expect the haystack to be huge even without any memory leaks. & if my computer can't handle that I'll go to some cloud computing thing to do it.

What tests you're running
In addition to the ones mentioned already, I've tried is_cycle_ok(), weaken() & I don't remember what else.

How and where you're using %haystack (beyond the assignment you show)
I was thinking of creating all polynomials with integer solutions, whose derivatives also have integer solutions. So a hash where the keys are the solutions of the polynomials and corresponding values are the solutions of the derivatives. The subroutine below searches the derivatives' zeros for zero-sets that only contain "approximte" integers. Then a hash slice gets created with the keys I want & Dumper prints it out. Here are the threads
http://perlmonks.org/?node_id=1027571
http://perlmonks.org/?node_id=1028273

Here's the entire program, finished with assistance of user hdb who replied earlier in this node, & after changing a, b & c to x, y & z:

#!/usr/bin/perl -w #use strict; use warnings; use Data::Dumper; use Math::Polynomial::Solve qw! poly_derivative poly_roots !; use Math::Round qw! round !; use Devel::Size qw! size total_size !; use Scalar::Util qw! weaken isweak !; use Test::Memory::Cycle; use Test::LeakTrace; my %haystack; # $rep means right endpoint of the interval [0, $rep] my $rep = int 3; foreach my $x (3 .. $rep ) { foreach my $y (2 .. $x-1 ) { foreach my $z (1 .. $y-1 ) { # expanded form of x*(x - $x)*(x - $y)*(x - $z) # coeffs are in an array $haystack{"$x, $y, $z"} = [ poly_roots( poly_derivative( 1, -$x - $y - $z, $x*$y + $x*$z + $y*$z, -$x*$ +y*$z, 0 ) ) ]; } } } # for each zero in @zeros, assigns a truth value to whether or not it +is within 0.0001 of an integer (1=true, 0=false) sub is_approximately_an_integer { my $eps = 0.0001; while( my $x = shift ) { # need to use "round", "int" does not work! return 0 if abs( $x-round($x) ) > $eps; } return 1 } # this returns only the arrays but loses keys #print "\nSelected arrays\n"; my @wants = grep { is_approximately_an_integer( @$_ ) } values %haysta +ck; #print Dumper( @wants ); # this returns the keys #print "\nSelected keys...\n"; @wants = grep { is_approximately_an_integer( @{$haystack{$_}} ) } keys + %haystack; print Dumper( @wants ); # and you can get the arrays as well #print "\n...and the associated array.\n"; #print Dumper( @haystack{@wants} ); my $polys = $#wants + 1; # prints out the corresponding values from %haystack #if ( @wants ) { # print "\nWe found $polys polynomials!\n"; #} else { # print "No polynomials here. Try another interval.\n"; #}; my $size = size(\%haystack); my $total_size = total_size(\%haystack); print "\nThe size of haystack is $size bytes.\n"; print "The size of haystack including references is $total_size bytes. +\n"; my $sizewants = size(\@wants); my $totalsizewants = total_size(\@wants); print "\nThe size of wants is $sizewants bytes.\n"; print "The size of wants including references is $totalsizewants bytes +.\n";

In reply to Re^2: help with memory leak by crunch_this!
in thread help with memory leak by crunch_this!

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.