def get_memory_stats(self): mem_alloc = gc.mem_alloc() mem_free = gc.mem_free() return { 'mem_alloc': mem_alloc, 'mem_free': mem_free }