Jonathan Leto: May 2009 Archives

Test::More eating your memory?

| | TrackBacks (0)
It always humors me when I am having some issue with a Perl module, thinking that I am the only one, and then reading my RSS feed and seeing someone having exactly the same issue.

I wrote an eXtended Test (xt/verify_strong.t) for Math::Primality which verifies that it correctly identified all strong pseudoprimes less than 1e15. That is 1,000,000,000,000,000 ! There end up being  419489 such numbers, so I thought nothing of writing

use Test::More tests => 419489;

Needless to say, I was a bit worried to see my test process constantly eating RAM, ending up utilizing about 650MB of RAM before exiting. I thought that maybe there was a memory leak in Math::GMPz, which Math::Primality uses to access the GNU MultiPrecision (GMP) library. But after making this small patch to roll my own ok() method, my memory usage plummeted to about 50MB, over a 90% memory usage decrease!

The very next day I see garu talking about the very same issue. Evidently it is "working as designed" according to Schwern and it comes down to Test::Builder saving the history/output of every test, which is not currently configurable. This is one of the many things that Test::Builder2 will hopefully solve.

Recent Hacktivity

| | TrackBacks (0)
I have been improving the test coverage and portability of Math::GSL and hacking and getting Math::Primality in a state so that my GSoC student can work on it. This involved porting it to use Math::GMPz (thanks Sysiphus!) instead of my fork of Math::BigInt::GMP on github. I have learned the way of "minimization of maintainence." This is again a lesson in not doing thorough enought prior art research before slicing into it with a large, dull chainsaw.

I have noticed an explosion of Perl-related blogs lately, it is great to see many facets of the Perl community in blog and RSS form, instead of only in mailing list posts. Adding more mediums of communication only strengthens ideas and spreads them faster.

About this Archive

This page is a archive of recent entries written by Jonathan Leto in May 2009.

Jonathan Leto: April 2009 is the previous archive.

Jonathan Leto: June 2009 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Clicky Web Analytics 42