def iterations(): check_garbage() max_mem = 0 max_mem_stable = 0 max_mem_increasing = 0 leak = True m1 = 0 for i in range(options.max_iterations): yield i if options.debug: if i == 3: check_garbage() helpers.record_memory_leak_status() if i == 4 or i == 5: helpers.record_memory_leak_status(print_diff=True) m2 = mem() print('iteration %02d/%02d: %d pages used (%+d)' % ( i + 1, options.max_iterations, m2, m2 - m1)) m1 = m2 if m2 > max_mem: max_mem = m2 max_mem_stable = 0 max_mem_increasing += 1 if max_mem_increasing == options.required: print('maximum was always increasing for', max_mem_increasing, 'iterations') break else: max_mem_stable += 1 max_mem_increasing = 0 if max_mem_stable == options.required: print('maximum was stable for', max_mem_stable, 'iterations') leak = False break check_garbage() if leak: print('memory leak found') sys.exit(LEAK_EXIT_CODE) else: print('no leak found')
def iterations(): check_garbage() max_mem = 0 max_mem_stable = 0 max_mem_increasing = 0 leak = True m1 = 0 for i in range(options.max_iterations): yield i if options.debug: if i == 3: check_garbage() helpers.record_memory_leak_status() if i == 4 or i == 5: helpers.record_memory_leak_status(print_diff=True) m2 = mem() print('iteration %02d/%02d: %d pages used (%+d)' % (i + 1, options.max_iterations, m2, m2 - m1)) m1 = m2 if m2 > max_mem: max_mem = m2 max_mem_stable = 0 max_mem_increasing += 1 if max_mem_increasing == options.required: print('maximum was always increasing for', max_mem_increasing, 'iterations') break else: max_mem_stable += 1 max_mem_increasing = 0 if max_mem_stable == options.required: print('maximum was stable for', max_mem_stable, 'iterations') leak = False break check_garbage() if leak: print('memory leak found') sys.exit(LEAK_EXIT_CODE) else: print('no leak found')
def print_memory_leak_cb(self, action): helpers.record_memory_leak_status(print_diff = True)
def print_memory_leak_cb(self, action): helpers.record_memory_leak_status(print_diff=True)