Debugging heap corruption

Regan Heath regan at netmail.co.nz
Mon Jul 30 05:04:00 PDT 2007


Vladimir Panteleev wrote:
> On Mon, 30 Jul 2007 13:16:32 +0300, Regan Heath <regan at netmail.co.nz>
> wrote:
> 
>> I haven't heard of "Phobos's GC SENTINEL option" what is it?  Where
>> can I read about it in the D docs?
> 
> I described it in the original post. It is unfinished and thus
> undocumented. Quoted:
> 
>> I noticed that Phobos's GC has some debug code for
>> "underrun/overrrun protection" [sic] in phobos\internal\gc\gcx.d,
>> however I found that the code is unfinished. For some reason the
>> corresponding code is put in "version (SENTINEL)" blocks, instead
>> of "debug (SENTINEL)" ones - which would explain why it never
>> worked (there is also a typo in code on line 567). Even with those
>> obvious mistakes fixed, I have no idea how much work would be
>> required to get the SENTINEL debug option working, since it's
>> interfering with other language features such as array
>> concatenation, and firing off false alarms.

Ahh, sorry, I didn't recall the phrase SENTINEL in your earlier post.

>>> I assume that what you said doesn't apply to D?
>> I'm not sure what you mean?  Which part of what I said are you
>> assuming doesn't apply to D?
> 
> If what you said applies to D, then you must have used your own
> allocation routines only in your own code (I.E. you don't hook D's
> memory allocation), since you didn't know if it's possible to
> substitute the standard "global allocator". In that case, your code
> will have the same effect as using libc's malloc() and Valgrind
> (except your code wouldn't be able to detect immediately when an
> overflow has happened). See the rest of this thread for details
> (particularly my reply to Matthias).

My own code which used this technique was written in C.

Regan



More information about the Digitalmars-d mailing list