On Aug 27, 9:07 am, rjf <fate...@gmail.com> wrote:
> Let GMP do its own memory allocation.  After Lisp has itself allocated
> a structure S with a pointer to a GMP-allocated object, it knows what
> to do: either S is
> used or not, determined by a garbage collection.   When S is
> determined to be not used, mpz_clear  or whatever, is called. This
> actually may not happen at the next garbage collection, but at the one
> after.

This is roughly what ECL was doing before, but they made sure that GMP
would allocate the limbs on the GC managed heap. That way they saved
themselved having to call mpz_clear but more importantly, the GC would
have a proper view of the memory usage (and hence can trigger a GC
when appropriate).

If you let GMP allocate the limbs outside of the GC managed heap, they
are outside of the view of the GC, so the GC gets a very skewed view
of memory usage. If your GC is really eager to collect garbage, you
might be OK, but otherwise you run the risk of ending up with a lot of
garbage allocated on the malloc heap while the GC thinks there are
only a bunch of structs consisting of 2 ints and a pointer lying
around.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to