Safety, undefined behavior, @safe, @trusted

dsimcha dsimcha at yahoo.com
Thu Nov 5 14:19:28 PST 2009


== Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> dsimcha wrote:
> > Ok, I understand the basic principle of a reap, but if it's going to convert to a
> > heap when you try to delete something, why not just improve the standard GC heap,
> > i.e. by making per-thread heaps?
> The problem with per-thread heaps is immutable data can be passed
> between threads.

What does this have to do with anything?  If allocation is done w/o locking by
using TLS, (manual) freeing could simply check that the thread ID of the block
matches the thread ID of the thread doing the freeing and if so, free the memory
to the thread-local heap w/o locking.  Of course, GCing would still have to stop
the world.



More information about the Digitalmars-d mailing list