DisposeResourcesVisitor.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.data.experiment.scope.visitors;
00002 
00003 import edu.rice.cs.hpc.data.experiment.scope.AlienScope;
00004 import edu.rice.cs.hpc.data.experiment.scope.CallSiteScope;
00005 import edu.rice.cs.hpc.data.experiment.scope.FileScope;
00006 import edu.rice.cs.hpc.data.experiment.scope.GroupScope;
00007 import edu.rice.cs.hpc.data.experiment.scope.LineScope;
00008 import edu.rice.cs.hpc.data.experiment.scope.LoadModuleScope;
00009 import edu.rice.cs.hpc.data.experiment.scope.LoopScope;
00010 import edu.rice.cs.hpc.data.experiment.scope.ProcedureScope;
00011 import edu.rice.cs.hpc.data.experiment.scope.RootScope;
00012 import edu.rice.cs.hpc.data.experiment.scope.Scope;
00013 import edu.rice.cs.hpc.data.experiment.scope.ScopeVisitType;
00014 import edu.rice.cs.hpc.data.experiment.scope.StatementRangeScope;
00015 
00016 
00017 /*******************************************************************
00018  * 
00019  * Visitor class to remove resources manually
00020  * 
00021  * It appears that mutual object references will not be removed from
00022  * the head even if the parent or the children or one of them is nullified. 
00023  * It seems JVM is not smart enough to traverse the tree to free the heap.
00024  * 
00025  * This class will traverse all the tree and dispose all the resources
00026  * manually.
00027  *
00028  *******************************************************************/
00029 public class DisposeResourcesVisitor implements IScopeVisitor 
00030 {
00031     public void visit(Scope scope, ScopeVisitType vt) { inspect(scope, vt); }
00032     public void visit(RootScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00033     public void visit(LoadModuleScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00034     public void visit(FileScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00035     public void visit(ProcedureScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00036     public void visit(AlienScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00037     public void visit(LoopScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00038     public void visit(StatementRangeScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00039     public void visit(CallSiteScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00040     public void visit(LineScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00041     public void visit(GroupScope scope, ScopeVisitType vt) { inspect(scope, vt); }
00042 
00043     
00044     private void inspect(Scope scope, ScopeVisitType vt) {
00045         
00046         if (vt == ScopeVisitType.PostVisit) {
00047             scope.dispose();
00048         }
00049     }
00050 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1