Attached is v5 of the patch, fixing an error with releasing a sharedmemory context (invalid flag values in a few calls).
kind regardsTomas Vondra