docs: Fix memory module documentation discrepancies

- Add missing PoolAllocator class overview with methods table
- Add missing LinearAllocator class overview with methods table
- Add missing ProxyAllocator class overview with methods table
- Fix PoolAllocator::Allocate example code and comments
- Clarify ProxyAllocator::Free totalFreed calculation behavior
- Fix CreateLinearAllocator complexity from O(size) to O(1)
- Add note about Reallocate thread safety in ProxyAllocator
This commit is contained in:
2026-03-19 00:48:44 +08:00
parent 5fc18eac6f
commit 98c764bab9
8 changed files with 142 additions and 14 deletions

View File

@@ -4,7 +4,9 @@
void Free(void* ptr) override;
```
释放内存并记录统计。调用转发到底层分配器,同时更新统计信息:递增 `totalFreed`(累加当前分配计数),并递减 `allocationCount`。由于 ProxyAllocator 不记录单独释放的字节数,`totalFreed` 累加的是 `allocationCount` 而非实际字节大小
释放内存并记录统计。调用转发到底层分配器,同时更新统计信息:递增 `totalFreed`(累加当前 `allocationCount`),并递减 `allocationCount`
**注意:** `totalFreed` 累加的是每次释放时的 `allocationCount`(分配计数)而非实际字节大小。这是一个简化的实现,用于追踪释放操作次数。
**参数:**
- `ptr` - 指向要释放的内存块