- 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
957 B
957 B
LinearAllocator::SetMarker
void SetMarker(void* marker);
恢复到之前通过 GetMarker 获取的标记位置。所有在标记之后的分配都将被丢弃,内部偏移量重置为该标记位置。此方法不会释放内存,只是移动偏移量指针。
参数:
marker- 通过GetMarker获取的标记指针
返回: 无
复杂度: O(1)
示例:
#include <XCEngine/Memory/LinearAllocator.h>
LinearAllocator allocator(1024);
// 基础数据
void* base = allocator.Allocate(256);
void* marker = allocator.GetMarker();
// 可选的扩展数据
void* ext1 = allocator.Allocate(64);
void* ext2 = allocator.Allocate(128);
// 决定不使用扩展数据,回滚
allocator.SetMarker(marker);
// 扩展数据内存已被回收
// 可以重新分配其他数据
void* new_data = allocator.Allocate(128);
相关文档
- LinearAllocator 总览 - 返回类总览