Memory issue

Torbjorn Granlund tg at
Fri Dec 17 00:31:32 CET 2010

Craig Helfgott <chelfgott at> writes:

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


More information about the gmp-discuss mailing list