allocated blocks holding pointers to other allocated blocks

David Warme David at Warme.net
Thu Mar 6 03:55:48 UTC 2014


I am posting this to gmp-devel (instead of gmp-discuss) because it
concerns very arcane GMP implementation details.

The GMP manual on Custom Allocation contains the following paragraph:

	GMP may use allocated blocks to hold pointers to other allocated
	blocks.  This will limit the assumptions a conservative garbage
	collection scheme can make.

Questions:

1. This seems like a situation that can only exist while certain GMP
    routines are active in the call stack context -- if no GMP function is
    active, then this situation will not exist, correct?

2. What places within GMP use this technique (pervasive, or hopefully
    just a few places)?

3. How difficult would it be to encapsulate such blocks and provide
    the ability for a conservative garbage collector to trace them?

4. Are these blocks (containing pointers to other allocated blocks)
    always allocated using the TMP_DECL, TMP_MARK, TMP_FREE mechanism?

5. If so, then would tracing of these blocks have to start from some
    root pointer that is "thread local" (i.e., one root per thread)?

The additional bookkeeping this would require obviously adds overhead,
and would have to be wrapped within some configuration options such as
--enable-gc-tracing.



More information about the gmp-devel mailing list