示例#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()
示例#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)
示例#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()
示例#4
0
def evalTest(code, N):
    from System import GC
    startMem = GC.GetTotalMemory(True)
    startTime = clock()
    evalLoop(code, N)
    endTime = clock()
    if is_mono:
        gc.collect()
    else:
        gc.collect(2)
    endMem = GC.GetTotalMemory(True)
    return max(endMem - startMem, 0)
示例#5
0
    def __form_closed_fired(self, sender, args):
        ''' This method is called just after this form closes. '''

        # deregister listers; prevents infinite loop!
        self.__scraper.start_scrape_listeners.remove(self.__start_scrape)
        self.__scraper.cancel_listeners.remove(self.close_threadsafe)

        # in some cases, we should interpret the closing of this form as
        # a request by the user to cancel the entire scrape operation...
        if self.__cancel_on_close:
            self.__scraper.cancel()

        # clean up and disposal
        self.__current_book = None
        self.__current_page = 0
        self.__pbox_panel.Dispose(True)
        del self.__pbox_panel
        GC.Collect()
示例#6
0
 def get_memory():
     for _ in range(4):
         GC.Collect()
         GC.WaitForPendingFinalizers()
     return GC.GetTotalMemory(True) / 1e6
示例#7
0
def gcwait():
    GC.Collect()
    GC.WaitForPendingFinalizers()
示例#8
0
 def onClick(sender, args):
     GC.Collect()