Currently the XProcRuntime instances in XProcRegistry aren't always cleaned up properly when cx:eval is used. It's the same issue that I reported a while ago in #82 (comment).
This PR is the quick fix, however it seems to me that the real problem lies within XProcRegistry. I guess I just don't see what this class does. From what I can tell, you could just as well store the XProcRuntime directly inside the XProcExtensionFunctionDefinition. I think I have to agree with what @jwcranford said in #152 (comment). This patch from @rdeltour from back in 2011 still seems relevant indeed.
For reference: these are all the previous issues and commits I could find about this topic, in chronological order:
Storing the XProcRuntime in the extension sometimes lead to the wrong context being present in the evaluation of the extension function. I can't recall exactly how, just at the moment.
I concede there's room for improvement here. In the short term, I'm going to merge your fix.