in reply to Re^3: help with memory leak
in thread help with memory leak

I'm suggesting you do something like this (which does away with %haystack altogether):
my @wants; ... push @wants, grep { is_approximately_an_integer( @$_ ) } [ poly_roots( ...

OK that works much better, more efficient & no problems of any kind with leaktrace or no_leaks_ok, etc. The reason I thought a hash would be a good idea was that I'm also interested in getting back the corresponding $x, $y, $z at the end. That's why the coeffecients look the way they do in the poly_derivative definition. Is there a way to do that without using a hash? If not I'd still gladly trade that for more efficiency because I can always integrate what I get, or I could just work with the coefficients rather than the zeros.

Replies are listed 'Best First'.
Re^5: help with memory leak
by kcott (Archbishop) on Apr 18, 2013 at 21:58 UTC

    Something like this perhaps:

    ... push @wants, map { { join('-', $x, $y, $z) => $_ } } grep { is_approximately_an_integer( @$_ ) } [ poly_roots( ...

    -- Ken

      awesome! thx for the help, & sorry about the PMs, I didn't know I could customize how many replies would show up.