When a blob is used in the context of a PREDICATE() 
macro, it can raise a C++ exception (PlFail or PlException) 
and the
PREDICATE() code will convert 
the exception to the appropriate Prolog failure or error; memory 
allocation exceptions are also handled.
Blobs have callbacks, which can run outside the context of a PREDICATE(). Their exception handling is as follows:
PlAtom::null, 
which is interpreted by Prolog as failure.false (or throw a PlException or
PlExceptinFailBase, which will be interpreted as a return 
value of false), resulting in the blob not being garbage 
collected, and the destructor not being called. Note that this doesn't 
work well with final clean-up atom garbage collection, which disregards 
the return value and also doesn't respect the ordering of blob 
dependencies (e.g., if an iterator blob refers to a file-like blob, the 
file-like blob might be deleted before the iterator is deleted).
This code runs in the gc thread. The only PL_*() 
function that can safely be called are
PL_unregister_atom() (which is what PlAtom::unregister_ref() 
calls).