[plt-scheme] Is there any way to disable object moving in GC temporarily?

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Jun 2 21:46:00 EDT 2008

On Jun  3, Chiyuan Zhang wrote:
> Hi,
> For some reason, I can't use the MZ_GC_DECL_REG, MZ_GC_VAR_IN_REG and
> MZ_GC_REG related macros provided by mzscheme sometimes. I'm just
> wondering is there any function to prevent some pointer pointed object
> from being moved. Just like the scheme_dont_gc_ptr function to prevent
> an object from being collected. Or is it possible to write such a
> helper function?

If you use plain `malloc', the blocks are not visible to the GC so
they'll stay in place.  If you want pointers that the GC can see but
will not move, then look for immobile boxes.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.