Memory allocation issue with Garbage Collection

Kral Stefan skral at mips.complang.tuwien.ac.at
Fri Sep 30 18:12:32 CEST 2005


Hi.

Currently working on a GMP binding for Mercury
(a purely declarative logic programming language), I had
the problem of integrating of GMP and the boehm-weiser 
conservative garbage collector.

mp_set_memory_functions basically gives me what I need, 
apart from the fact that there is no way of supplying
a malloc for some storage guaranteed not to contain
any pointers (GC_MALLOC_ATOMIC). 

This is extremly important for performance, 
especially on 32-bit architectures.

So I got the idea of adding some function
mp_set_memory_functions_2, which takes an additional 
argument (malloc_atomic) and registers it.

Then, functions like init could allocate atomic blocks.

Does this sound like a reasonable idea to you?
Or does anyone of you have a similar problem 
(or even better a solution)?

Cheers,
Stefan.

-- 
Stefan Kral            http://www.complang.tuwien.ac.at/skral/



More information about the gmp-discuss mailing list