Exemplo n.º 1
0
	def __exit__(self, type, value, traceback):
		"Quit the app and perform garbage collection"
		if self._app is not None:
			self._app.Quit()
			self._app = None
		GC.Collect()
		GC.WaitForPendingFinalizers()
		GC.Collect()
		GC.WaitForPendingFinalizers()
Exemplo n.º 2
0
    def tearDown(self):
        import clr
        from System import GC

        for i in range(3):
            GC.Collect()
            GC.WaitForPendingFinalizers()

        if os.path.isfile(self.filename):
            os.unlink(self.filename)
Exemplo n.º 3
0
def gcwait():
    """
    Attempt to force a garbage collection, and wait for pending finalizers.
    
    If you think you need to call this function, you're probably wrong.
    """
    for _ in range(4):
        _mapper.DemandCleanup()
        GC.Collect()
        GC.WaitForPendingFinalizers()
Exemplo n.º 4
0
 def get_memory():
     for _ in range(4):
         GC.Collect()
         GC.WaitForPendingFinalizers()
     return GC.GetTotalMemory(True) / 1e6
Exemplo n.º 5
0
def gcwait():
    GC.Collect()
    GC.WaitForPendingFinalizers()