def create_c_buffer_and_del(size: int): input( f'Waiting to create buffer PID={os.getpid()}, size={size} <cr> to continue... ' ) b = cMemLeak.CMalloc(size) input( f'Waiting to del buffer PID={os.getpid()}, size={size} <cr> to continue... ' ) del b input( f'DONE del buffer PID={os.getpid()}, size={size} <cr> to continue... ')
def create_cmalloc_list(): l = [] for i in range(4): block = cMemLeak.CMalloc(1477) print(f'Created CMalloc size={block.size:d} buffer=0x{block.buffer:x}') l.append(block) while len(l): # Remove in reverse order block = l.pop(0) print(f'Pop\'d CMalloc size={block.size:d} buffer=0x{block.buffer:x}') l.clear()
def create_c_buffer(size: int): b = cMemLeak.CMalloc(size) # logger.info(f'create_c_buffer() {b.size} at 0x{b.buffer:x}') print(f'create_c_buffer() {b.size} at 0x{b.buffer:x}') return b
def test_cmalloc_object(): cobj = cMemLeak.CMalloc(1024) assert cobj.size == 1024