I added a helper function for it, based on the Stack Overflow answer, and applied it everywhere we do a memory check.
Note that I also had to commit some other rather more significant changes I've had cooking, as I hadn't created branches for those changes. I'm (relatively) confident those changes are ready to go, I've been running them for several weeks, but if you get funky behavior with either ...
How repeated joined data gets selected (like too many / not enough rows when paginating a list with joined data)
... or ...
JS errors when loading popup windows (like jQuery getting redefined)
... then maybe they weren't.
-- hugh