Fwd: Huge number crash ...

12 views
Skip to first unread message

Jason

unread,
Sep 24, 2011, 2:36:04 PM9/24/11
to mpir-...@googlegroups.com

---------- Forwarded Message ----------

Subject: Huge number crash ...
Date: Wednesday 21 September 2011, 18:38:42
From: manu hobert <manu....@gmail.com>
To: themp...@gmail.com

Hello,
I'm trying to make some programs to calculate some quite huge numbers, like
phi with 1 000 000 000 decimals (witch uses about 1GB ram) ...
but when my ram usage got too high ~1GB it crashed and said: "cannot
allocate memory (size=*****)".
this happens with all of my programs, as soon as it goes too big it crashes.
i have enough ram though, i've got 4GB ram (when i run my progs i have about
2.5 - 3 GB free memory).
I haven't got any idea why this happens to me ...

some extra info:
- i'm using mpir 2.4.0
- i use the gc version
- i compiled mpir as a static lib

--
Manu

-----------------------------------------

Cactus

unread,
Sep 24, 2011, 4:37:35 PM9/24/11
to mpir-...@googlegroups.com
It is not clear that you are building with Visual Studio but if you are, you
will have to use your application's Linker|System property page to enable
large addresses if you want to use more than 2GB of memory.

You may also have to use this page to increase the amount of memory for the
heap and/or the stack when your program starts.

Brian Gladman

Sisyphus

unread,
Sep 24, 2011, 6:39:25 PM9/24/11
to mpir-...@googlegroups.com, manu....@gmail.com

----- Original Message -----
From: "Jason" <ja...@njkfrudils.plus.com>
To: <mpir-...@googlegroups.com>
Sent: Sunday, September 25, 2011 4:36 AM
Subject: [mpir-devel] Fwd: Huge number crash ...


>
> ---------- Forwarded Message ----------
>
> Subject: Huge number crash ...
> Date: Wednesday 21 September 2011, 18:38:42
> From: manu hobert <manu....@gmail.com>
> To: themp...@gmail.com
>
> Hello,
> I'm trying to make some programs to calculate some quite huge numbers,
> like
> phi with 1 000 000 000 decimals (witch uses about 1GB ram) ...
> but when my ram usage got too high ~1GB it crashed and said: "cannot
> allocate memory (size=*****)".
> this happens with all of my programs, as soon as it goes too big it
> crashes.
> i have enough ram though, i've got 4GB ram (when i run my progs i have
> about
> 2.5 - 3 GB free memory).
> I haven't got any idea why this happens to me ...

Try rebuilding mpir with the configure
option --enable-alloca=malloc-reentrant.
If reentrancy is not required, configuring instead
with --enable-alloca=malloc-notreentrant should be faster (and therefore
preferable). See http://gmplib.org/manual/Build-Options.html#Build-Options .

I'm not sure if that will solve your problem - but worth trying, imo.

Cheers,
Rob

Case Vanhorsen

unread,
Sep 24, 2011, 8:02:25 PM9/24/11
to mpir-...@googlegroups.com, manu....@gmail.com
On Sat, Sep 24, 2011 at 11:36 AM, Jason <ja...@njkfrudils.plus.com> wrote:
>
> ----------  Forwarded Message  ----------
>
> Subject: Huge number crash ...
> Date: Wednesday 21 September 2011, 18:38:42
> From: manu hobert <manu....@gmail.com>
> To: themp...@gmail.com
>
> Hello,
> I'm trying to make some programs to calculate some quite huge numbers, like
> phi with 1 000 000 000 decimals (witch uses about 1GB ram) ...
> but when my ram usage got too high ~1GB it crashed and said: "cannot
> allocate memory (size=*****)".
> this happens with all of my programs, as soon as it goes too big it crashes.
> i have enough ram though, i've got 4GB ram (when i run my progs i have about
> 2.5 - 3 GB free memory).
> I haven't got any idea why this happens to me ...

One thing to keep in mind is the amount of temporary memory that needs
to be allocated to calculate the result. I calculated sqrt(5) to
325,000,000 decimal places and the calculation consumed over 2GB of
RAM.


>
> some extra info:
> - i'm using mpir 2.4.0
> - i use the gc version
> - i compiled mpir as a static lib
>
> --
> Manu
>
> -----------------------------------------
>

> --
> You received this message because you are subscribed to the Google Groups "mpir-devel" group.
> To post to this group, send email to mpir-...@googlegroups.com.
> To unsubscribe from this group, send email to mpir-devel+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mpir-devel?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages