GC removeRange/removeRoot API issue

safety0ff via Digitalmars-d digitalmars-d at puremagic.com
Thu May 8 11:14:05 PDT 2014


On Thursday, 8 May 2014 at 14:20:58 UTC, Orvid King via 
Digitalmars-d wrote:
> What's the reasoning for the current behavior of add/remove 
> range?

I think the behaviour only stems from the simple implementation 
rather than reason.

After sleeping on the question, I realise there's no way around 
dealing with duplicates.

The new questions are:
- Should there be a way to remove ranges less conservatively 
(e.g. via explicit size parameter for removeRange)
- Should there be a way of 'forcing' removal of a range/root? 
(e.g. we're about to free() some memory, force the GC to ignore 
duplicate add root/range calls and remove it.)

The interface might look like:

void removeRange(void* p, size_t size=0, bool force=false)
if size is zero, conservatively remove range/root
if force is true then remove all scanning of the range/root
if size is zero and force is true, all ranges/root specified by p 
will be removed

Thoughts?


More information about the Digitalmars-d mailing list