[RFC]Proposal for better garbage collection

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Feb 22 16:45:29 PST 2012


On Wed, Feb 22, 2012 at 03:05:38PM -0800, Sean Kelly wrote:
> On Feb 22, 2012, at 10:56 AM, Benjamin Thaut wrote:
> > 
> > 5) pointer / reference changed callback
> > 
> > Every time a pointer / reference is changed the D compiler emits a
> > call into the runtime and passes the new value of the reference /
> > pointer with it.
> > 
> > void _d_pointerChanged(void *ptr);
> 
> D can call assembler, C routines like memset(), plain old opaque C
> library code, etc.  What should the D compiler do in light of all the
> sources of memory changes that it can't monitor?
[...]

Yeah, the GC should be capable of dealing with non- at safe code. Otherwise
it would just be too limited to be used for large non-trivial D
projects.

But still, some benchmarks do appear to be showing signs of a large
performance hit on the GC when there happens to be many integers that
look like valid pointers. This may be beyond the programmer's control,
since it could be the OS that gives the GC an address segment that just
happens to span integer values very commonly used throughout the app.


T

-- 
What doesn't kill me makes me stranger.


More information about the Digitalmars-d mailing list