Memory issue

Sam Rawlins sam.rawlins at
Fri Dec 17 01:58:56 CET 2010

Hi Craig,

Did you look into MPFR's mpfr_exp?

Do you run out of memory when you only run "the inner loop" 1000 times? 100?

We're pretty blind without any source code.

On Thu, Dec 16, 2010 at 3:47 PM, Craig Helfgott <chelfgott at> wrote:

> I am in the process of writing a program using GMP in C++, and am hitting a
> memory issue.  Specifically, I have a subroutine that will output e^x for x
> an mpf_class variable.  It works using the standard binary splitting
> algorithm, and is fairly fast even though I am currently working with
> 32,768-bit numbers.  I am running it a few thousand times in the inner loop
> of my program.  I of course expect this to take some time, perhaps a day at
> most, but I do not expect it to take much memory, since I only have at most
> 50 such variables active at any one time.  However, when I run my program,
> it immediately eats up the memory in my system.  Do I need to do mpf_clear
> in my exp subroutine?  (I thought the C++ interface would handle that for
> me.)  Is my compiler for some reason unwrapping my loop and trying to
> parallelize? (I'm using g++ with no special flags aside from -lgmp and
> -lgmpxx).
> Help?
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at

Sam Rawlins

More information about the gmp-discuss mailing list