[plt-scheme] precise GC example?
On Sat, 2007-12-29 at 13:51 -0600, Matthew Flatt wrote:
> At Fri, 28 Dec 2007 23:13:51 -0500, tom sgouros wrote:
> > I wonder, though, if anyone has a more elaborate example of the genre
> > to share than the one in collects/mzscheme/example. I'd be particularly
> > grateful as well for an example that worked via the mzc --xform compile.
>
> I'm not sure whether it has the kinds of things you're looking for, but
> the code in plt/src/mzscheme/src is all processed by xform to build
> mzscheme3m.
>
> > I also wonder about testing. With GC issues, I'm thinking that merely
> > working isn't a particularly good test. How can I be sure that I've
> > done this correctly and that I'm not merely creating opportunities for
> > obscure failures at random times in the future?
>
> You're right: it's very difficult to test. Unfortunately, I don't have
> a better answer than "make sure you understand the issues and write
> code that works".
I don't know if this is still current, but I tripped up a lot of
problems a while back by increasing the number of collections with this
method (from Matthew):
> Configure with --enable-compact, and then change the #define of CHECKS
> from 0 to 1 in "src/mzscheme/gc2/compact.c". This increases the number
of
> consistency checks, but it's a long way for GCing at every
> opportunity (which would be prohibitively slow). You can change
> GROW_FACTOR to something closer to 1 to trigger more frequent
> collections.
Because you can't remove false positives, I found it was mostly a case
of increasing the collection frequency, writing tests which cause a lot
of collections and leaving them for hours running inside a debugger.
This worked for me, and I'm not using mzc to build my extensions, so I'm
doing all the MZ_GC_DECL_REG/MZ_GC_UNREG myself.
cheers,
dave