[GAP] Effect of using malloc for temporary allocations in GAP

Max Horn Max.Horn at math.uni-giessen.de
Mon Jan 2 14:07:34 GMT 2017


Dear all,

> On 02 Jan 2017, at 15:01, Dmitrii Pasechnik <Dmitrii.Pasechnik at cs.ox.ac.uk> wrote:
> 

[...]

> I would like to point out that GMP allows one to specify her/his own
> memory allocator: https://gmplib.org/manual/Custom-Allocation.html
> (I'm surprised that GAP does not use it, or does it?)

GAP cannot use these hooks, because the GAP GC is a moving GC. That means that
it could happen that, after making an allocating, the actual location of
an object (say, the inputs to the GMP function currently running) move. Since
GMP is not aware of this, and there is no way to teach it about this (other than
modifying its code, of course), a crash and/or corrupt data would result.

Of course we could "fix" this by changing our GC: Either by replacing it by
a different GC (the HPC-GAP uses Boehm GC, but for various reasons this
causes a noticeable speed decrease), or by enhancing the existing GC; but doing
that is a major undertaking.


Regards,
Max
-- 
Prof. Dr. Max Horn
AG Algebra
Mathematisches Institut
Justus-Liebig-Universität Gießen
Arndtstraße 2
D-35392 Gießen
Tel: (+49) 641 99-32044
Fax: (+49) 641 99-32049
E-Mail: max.horn at math.uni-giessen.de




More information about the Gap mailing list