Files
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

807 B

LinearAllocator::Free

void Free(void* ptr) override;

此方法对 LinearAllocator 无实际效果。线性分配器不支持单个内存块的释放,因为内存是顺序分配的,释放中间某块会破坏后续分配的完整性。需要释放所有内存时使用 Clear() 方法。

参数:

  • ptr - 被忽略

返回:

复杂度: O(1)(空操作)

示例:

#include <XCEngine/Memory/LinearAllocator.h>

LinearAllocator allocator(1024);
void* ptr = allocator.Allocate(256);
void* ptr2 = allocator.Allocate(128);

// Free 实际上什么都不做
allocator.Free(ptr);
allocator.Free(ptr2);

// 如需释放所有内存,应使用 Clear
allocator.Clear();

相关文档