std.allocator: false pointers

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri May 2 10:51:04 PDT 2014


On 5/2/14, 10:26 AM, Steven Schveighoffer wrote:
> False pointers are less of a problem in 64-bit code, but you can run
> into worse issues. If you are not zeroing the memory when deallocating,
> then if it mysteriously comes alive again, it has the ghost of what
> could be a pointer to other code. Your blocks are more likely to
> resurrect once one of them resurrects.

Good point.

> Why not keep the 3 states, but just treat unmarked blocks as free? Then
> the next time you go through tracing, change the bit to free if it was
> already marked.
>
> This doesn't save on the bit space, but I think the savings there is
> minimal anyway. However, it does allow the final pass to be saved.

That's a great idea. Thanks!


Andrei



More information about the Digitalmars-d mailing list