Memory issue

Craig Helfgott chelfgott at
Fri Dec 17 02:04:49 CET 2010

Huh.  Okay, I didn't know about mpfr.  That has pretty much all the special
functions I've spent the last two weeks writing.  Let me try it using those
functions instead and get back to you.  I'll check in in a day or two.

On Thu, Dec 16, 2010 at 7:58 PM, Sam Rawlins <sam.rawlins at> wrote:

> 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? 10?
> 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