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.

0 TrackBacks

Listed below are links to blogs that reference this entry: Test::More eating your memory?.

TrackBack URL for this entry: http://leto.net/mt/mt-tb.cgi/149

About this Entry

This page contains a single entry by Jonathan Leto published on May 15, 2009 6:30 AM.

Recent Hacktivity was the previous entry in this blog.

Why would you ever store a reference to a Perl string? is the next entry in this blog.

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

Clicky Web Analytics 42