Well, your suggestion of Scalar::Util::weaken worked out perfectly. It was easy to modify the parser items to weaken their link back to the main Formula object. There was also a similar recursive reference within the Context object, and that was also easily fixed. So I think the MathObjects no longer leak memory. I have submitted the changes to the CVS archive, and you should be able to update pg without updating webwork2.
Thanks for the suggestion; it was a big help. I had been worried about those recursive references for a long time, so it is nice to have them fixed.
WeBWorK Main Forum
Parser.pl: Traversal and maybe memory leaks
This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 10 posting(s) in 1 day