Calling clReleaseCommandQueue should never crash as long as you call it only once for any call to clRetain… plus once for the initial creation. E.g., command queues should have a effective user-level retain count of 1 on creation. (They may have extra internal retain counts, but if it crashes when you call it once then there’s a bug in the implementation.)