GNU MP error - Cannot allocate memory

manoj soni manoj6891 at gmail.com
Sun Mar 25 19:54:16 CEST 2012


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)

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff5cdd910 (LWP 1083)]
0x00007ffff6cb74e5 in raise (sig=<value optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64        return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
Current language:  auto
The current source language is "auto; currently c".
(gdb) backtrace
#0  0x00007ffff6cb74e5 in raise (sig=<value optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff6cb89b0 in abort () at abort.c:88
#2  0x00007ffff7b8f065 in __gmp_default_allocate () from


/usr/lib64/libgmp.so.3
#3  0x00007ffff7b9024b in __gmpf_init2 () from /usr/lib64/libgmp.so.3
#4  0x000000000042c4cb in MyDouble::operator+(MyDouble const&) const ()
#5  0x0000000000437669 in PartitionFunctionD2::calc_up


(this=0x7fffffffdf10,
    i=<value optimized out>, j=1072) at partition-func-d2.cc:532
#6  0x0000000000438b9d in PartitionFunctionD2::fill_partition_arrays (
    .omp_data_i=0x7fffffffde10) at partition-func-d2.cc:379
#7  0x00007ffff797e872 in ?? () from /usr/lib64/libgomp.so.1
#8  0x00007ffff6fe665d in start_thread (arg=<value optimized out>)
    at pthread_create.c:297
#9  0x00007ffff6d55ecd in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#10 0x0000000000000000 in ?? ()


Thanks,
Manoj


More information about the gmp-discuss mailing list