Safely extend the size of a malloced memory block after realloc

crimaniak via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 18 08:26:49 PDT 2015


On Tuesday, 18 August 2015 at 05:51:36 UTC, Benjamin Thaut wrote:

> I specifically asked for the case where the pointer doesn't 
> change. Obvisouly the case where it does change is easy, you 
> first add the new range and then remove the old one. But if you 
> do this and the pointer didn't change, the addRange doesn't do 
> anything because its a duplicate and the removeRange then 
> removes the range, because the pointer is still the same. You 
> then end up with the GC not knowing anything about the range 
> anymore.

May be implementing something like GC.resizeRange() will resolve 
such type of problem. Is it good idea or no?




More information about the Digitalmars-d mailing list