abort on error - is this being addressed?

Joerg Arndt arndt at jjj.de
Sat Aug 28 10:06:35 CEST 2010


* Vincent Lefevre <vincent at vinc17.net> [Aug 28. 2010 09:37]:
> On 2010-08-26 11:38:10 +0200, Marc Glisse wrote:
> > On Thu, 26 Aug 2010, Allan Chandler wrote:
> > >   GNU MP unconditionally calls abort() on allocation failures,
> > >   which are bound to happen with certain insanely large
> > >   computations. This is unacceptable behaviour for a library and
> > >   reason enough to write your own arbitrary-precision code.
> > 
> > First, notice that any OS that overcommits memory (like Linux unless
> > you use some option that is not recommended) makes the point moot.
> 
> Linux no longer blindly overcommits, so that if you have insanely
> large computations, malloc will fail.
> 

This is (and IIRC always has been) adjustable via sysctl:
% sysctl -a | grep commit
vm.overcommit_memory = 0
vm.overcommit_ratio = 50
vm.nr_overcommit_hugepages = 0
(kernel 2.6.34, opensuse 11.3)

Documentation is here:
 /usr/src/linux-2.6.34-12/Documentation/vm/overcommit-accounting

Even if the kernel overcommits (and one cannot change that)
there is a "pretty safe" strategy:
malloc all memory you'll need and write to it (to force
getting actual RAM), then use this memory as a pool.
The only(?) possible problem might by other applications
triggering the OOM-killer.

> -- 
> Vincent Lefèvre <vincent at vinc17.net> - Web: <http://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)
> _______________________________________________
> gmp-devel mailing list
> gmp-devel at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-devel


More information about the gmp-devel mailing list