Safe method wont check dangling pointer?

lzzll via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 15 00:22:38 PDT 2014


On Tuesday, 15 April 2014 at 07:09:34 UTC, Andrei Alexandrescu 
wrote:
> On 4/14/14, 10:47 PM, Walter Bright wrote:
>> On 4/14/2014 8:14 PM, lzzll wrote:
>>> I understand implemented this is hard and it need huge cost.
>>> It still be useful if we only use it to detect memory error 
>>> and trun
>>> it off when
>>> release.
>>> I'll be glad if I can see it on D after some years.
>>
>> Valgrind is an incredibly useful tool, but programs run 
>> terribly slowly
>> under it.
>
> ASAN = like valgrind but a crapton faster. -- Andrei

I think if stuff like this implemented on D will be more faster,
because D have "normal pointer" and "raw pointer",
that mean we only need check them on convert.

example:
A a = new A(); //a is safe
A *b = *a+1; //from normal pointer to raw pointer, no need check
A c = *b; //from raw point to normal point, so check here

But it require the code of D itself is safe, and asan is much 
low-level.


More information about the Digitalmars-d mailing list