GNU MP error - Cannot allocate memory

Torbjorn Granlund tg at
Sun Mar 25 20:07:56 CEST 2012

manoj soni <manoj6891 at> writes:

  Hi all,
  I am using gmp to calculate a matrix of big numbers (as they are out of
  range of double) using a dynamic programming algorithm. For small input
  size, it is running successfully but as I increase input size, it throws
  following error
  GNU MP: Cannot allocate memory (size=144)
  I also tried debugging the program using gdb and following is its output
  (and also backtrace), please have a look and suggest where can be the
  error. Does it have to do anything with precision in mpf_init2 (I am using
  1024 and 2048 and it throws error in both cases)
The reason GMP cannot allocate 144 bytes of memory is surely because
you've run out of virtual memory.  Configure more.  Or do you suspect
that your program leaks memory?  In the latter case, perhaps somebody
here could help you look at the code (unless it is very large).


More information about the gmp-discuss mailing list