Exemplo n.º 1
0
def record_memory(wait=0.1):
    assert gc.collect() == 0, 'Uncollected garbage!'
    world.barrier()
    time.sleep(wait)
    mem = MemoryStatistics()
    time.sleep(wait)
    world.barrier()
    return mem
Exemplo n.º 2
0
    def setUp(self):
        self.mem_ini = MemorySingleton(self.verbose - 1)
        self.mem_ref = MemoryStatistics(self.verbose - 1)
        self.mem_cur = self.mem_ref.copy()

        self.gc_threshold_old = gc.get_threshold()
        self.gc_flags_old = gc.get_debug()
        gc.set_threshold(*self.gc_threshold)
        gc.set_debug(self.gc_flags)

        # Try to obtain a clean slate
        gc.collect()
        self.gc_count = len(gc.garbage)
        del gc.garbage[:]