Browse Source

Implemented Modelverse Garbage Collection again (quite efficiently)

Yentl Van Tendeloo 7 years ago
parent
commit
e480917c8f

+ 4 - 0
hybrid_server/classes/mvkcontroller.xml

@@ -313,6 +313,10 @@
                                 self.execute_modelverse("", "protect_temporary_variables", [])
                                 self.execute_modelverse("", "protect_temporary_variables", [])
                                 self.mvs.purge()
                                 self.mvs.purge()
                                 self.execute_modelverse("", "unprotect_temporary_variables", [])
                                 self.execute_modelverse("", "unprotect_temporary_variables", [])
+
+                                # Clean up all used memory now, as this is rather much due to the copy of the MvS
+                                import gc
+                                gc.collect()
                             </script>
                             </script>
                             <raise scope="broad" event="resume_task"/>
                             <raise scope="broad" event="resume_task"/>
                         </onentry>
                         </onentry>

+ 2 - 2
state/modelverse_state/main.py

@@ -374,8 +374,8 @@ class ModelverseState(object):
             self.to_delete.add(t)
             self.to_delete.add(t)
 
 
     def purge(self):
     def purge(self):
-        print("PURGE")
-        #return
+        initial_nodes = len(self.nodes)
+        initial_edges = len(self.edges)
 
 
         while self.to_delete:
         while self.to_delete:
             t = self.to_delete.pop()
             t = self.to_delete.pop()

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Tue May 22 11:16:00 2018
+Date:   Tue May 22 11:57:59 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server