Associative Arrays and Interior Pointers

dsimcha dsimcha at yahoo.com
Sun May 10 11:04:40 PDT 2009


== Quote from Sean Kelly (sean at invisibleduck.org)'s article
> dsimcha wrote:
> >
> > 2.  Other than its abysmal interaction with the current GC and the lack of
> > ability to iterate using ranges, the current AA implementation actually seems
> > pretty good.  One way to remedy a large portion of the GC issues without a
> > massive overhaul of the GC would be to introduce a feature into the GC where a
> > block of memory can be flagged as NO_INTERIOR.
> Neat idea.  Some GCs (like the Boehm GC) can be set NO_INTERIOR
> globally, but it never crossed my mind to do this per block.  For
> certain data structures, this might be pretty useful.

I get the impression that D's GC will always have a significant degree of
conservatism.  Of course, there's always unions, but unioning a pointer type w/ a
non-pointer type is such an edge case that, if this is the only thing that's
conservative, then the GC can be considered precise for all practical purposes.
For now, I'd love to see this added, because it would be an extremely "cheap" way
to solve a lot of annoying problems.

A few questions:
1.  (For Leonardo, especially):  Is the GC likely to get precise enough in the
near future that something like this would end up being considered a piece of cruft?
2.  Other than that, is there any reason this should not go in?
3.  Sean, if you're seriously thinking of putting this in in the near future, let
me know so I can fix that patch, too.  I did it the same way as my other GC patch,
with no whitespace, so the line numbers might be screwy here, too.



More information about the Digitalmars-d mailing list