Replacement for GMP

John Meacham john at repetae.net
Wed Aug 2 17:22:54 EDT 2006


On Wed, Aug 02, 2006 at 03:22:57PM -0400, Peter Tanski wrote:
> >I suppose that one alternative is to let the library use 'malloc', but
> >make a foreign-pointer proxy for every bignum, which calls 'free' when
> >the GHC garbage collector frees it.  Not as efficient, though.
> 
> Esa and I had discussed the possibility of copying the value returned  
> from the Bignum lib into the GHC system, which certainly would not be  
> very memory efficient, but might be faster.  Among other memory  
> modifications, it might be a good idea to initialise the Bignum lib  
> with the RTS and modify the lib with a memory cache or garbage  
> collection system of its own.

I don't understand why this would be useful. Just use the standard FFI
ForeignPtr mechanism and it takes care of garbage collection for you and
doesn't have any issues with concurrency. This would also make the
library fully portable to any haskell implementation with FFI support.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Glasgow-haskell-users mailing list