Adding garbage collection for Proof objects. (#1294)