Memory issue

Craig Helfgott chelfgott at gmail.com
Fri Dec 17 01:10:42 CET 2010


What I am specifically asking is the following: 1) Do I need to run
mpf_clear if I am using mpf_class instead of mpf_t?  2)  Is there any reason
that g++ with the -lgmp and -lgmpxx flags would automatically parallelize a
loop at compile-time?


>  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).
>
> I don't understand how you think we can help you.  Are we supposed to
> somehow know how your source looks, and understand if it has a memory
> leak?
>
> --
> Torbjörn
>


More information about the gmp-discuss mailing list