Changes between Version 4 and Version 5 of Commentary/Rts/Sanity


Ignore:
Timestamp:
Jan 15, 2017 12:06:10 PM (3 years ago)
Author:
takenobu
Comment:

fix file names

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Rts/Sanity

    v4 v5  
    33= Sanity Checking =
    44
    5 Source code: [[GhcFile(rts/Sanity.c)]], [[GhcFile(rts/Sanity.h)]].
     5Source code: [[GhcFile(rts/sm/Sanity.c)]], [[GhcFile(rts/sm/Sanity.h)]].
    66
    77The purpose of sanity checking is to catch bugs in the RTS as early as possible; if the program is going to crash, we want it to crash as soon as possible after the error occurred.  The problem with debugging the RTS is that heap corruption can go unnoticed through several GC cycles, making it particularly difficult to trace back to the erroneous code.
     
    99Sanity checking is turned on by the `+RTS -DS` option.  We treat it like an expensive assertion: normal assertions are allowed to take a few extra percent of run time, so we don't mind having them on all the time in a `DEBUG` RTS, but sanity checking may double the run time of the program or worse.  So the rule of thumb is that expensive assertions go into sanity checking, cheap assertions are on in `DEBUG`, or possibly even on all the time.
    1010
    11 Sanity checking does a complete traversal of the heap after each GC to look for dangling pointers (see `checkHeap` in [[GhcFile(rts/Sanity.c)]]).  For this it needs to ensure that there is no [wiki:Commentary/Rts/Storage/Slop slop], which is why we can only do this in a `DEBUG` runtime: the slop-avoiding machinery is only on with `DEBUG`.
     11Sanity checking does a complete traversal of the heap after each GC to look for dangling pointers (see `checkHeap` in [[GhcFile(rts/sm/Sanity.c)]]).  For this it needs to ensure that there is no [wiki:Commentary/Rts/Storage/Slop slop], which is why we can only do this in a `DEBUG` runtime: the slop-avoiding machinery is only on with `DEBUG`.
    1212
    1313Sanity checking also turns on some other expensive checks: for example in the [wiki:Commentary/Rts/HaskellExecution#Genericapply generic apply] code we check that the arguments point to valid closures.