尝试进行 Qt 测试,增加了 AI 人机调试工具 _console,以及 TransPyV 进行修正
This commit is contained in:
@@ -418,17 +418,28 @@ class MemBuddy(MemManager):
|
||||
# === 虚函数覆盖 ===
|
||||
|
||||
def alloc(self, size: t.CSizeT) -> t.CVoid | t.CPtr:
|
||||
stdio.printf("DBG MemBuddy.alloc: size=%lu\n", size)
|
||||
stdio.fflush(None)
|
||||
self._lock()
|
||||
result: t.CVoid | t.CPtr = None
|
||||
if self.usable is not None:
|
||||
stdio.printf("DBG MemBuddy.alloc: usable=%p\n", self.usable)
|
||||
stdio.fflush(None)
|
||||
if size != 0:
|
||||
needed: t.CSizeT = size + MEMBUDDY_HEADER_SIZE
|
||||
order: t.CInt = self._order_for_size(needed)
|
||||
stdio.printf("DBG MemBuddy.alloc: order=%d max_order=%d\n", order, self.max_order)
|
||||
stdio.fflush(None)
|
||||
if order <= self.max_order:
|
||||
block: t.CVoid | t.CPtr = self._split_to_order(order)
|
||||
stdio.printf("DBG MemBuddy.alloc: block=%p\n", block)
|
||||
stdio.fflush(None)
|
||||
if block is not None:
|
||||
c.DerefAs(block, t.CVoid(t.CUInt64T((order << 1) | 1), t.CPtr))
|
||||
result = t.CVoid(t.CUInt64T(block) + MEMBUDDY_HEADER_SIZE, t.CPtr)
|
||||
else:
|
||||
stdio.printf("DBG MemBuddy.alloc: usable is None!\n")
|
||||
stdio.fflush(None)
|
||||
self._unlock()
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user