Alastair: >> What exception does deRefStablePtr raise when handed an invalid >> pointer such as 0? SimonM: > That's a good point, I don't think it has any error checking at all. > Of course the only way to get an invalid stable pointer is by > calling freeStablePointer on a valid one, or by using the FFI.