It seems odd that the "context" is reference-counted, but doesn't release itself when the reference count reaches zero. That might be the most robust solution.
Otherwise, you could release it in the destructor of a base class, or an extra member declared before the "ivar" members.