def test_get_process_memory(self): obj_size = 10 ** 7 orig = tracemalloc.get_process_memory() if orig is None: self.skipTest("get_process_memory is not supported") obj, obj_source = allocate_bytes(obj_size) curr = tracemalloc.get_process_memory() self.assertGreaterEqual(curr - orig, obj_size)
def test_get_process_memory(self): obj_size = 1024 * 1024 orig = tracemalloc.get_process_memory() if orig is None: self.skipTest("get_process_memory is not supported") obj, obj_source = allocate_bytes(obj_size) curr = tracemalloc.get_process_memory() # Allocating obj_size may allocate less memory than requested because # the Linux kernel overallocates memory mappings... or something like # that self.assertGreaterEqual(curr - orig, obj_size // 2)