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
This commit is contained in:
39
docs/api/memory/linear-allocator/get-used-size.md
Normal file
39
docs/api/memory/linear-allocator/get-used-size.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# LinearAllocator::GetUsedSize
|
||||
|
||||
```cpp
|
||||
size_t GetUsedSize() const;
|
||||
```
|
||||
|
||||
返回当前已使用的字节数,即内部偏移量的值。此值在 `Allocate` 后增加,在 `Clear` 或 `SetMarker` 后可能减少(取决于设置的目标位置)。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 已使用的字节数
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Memory/LinearAllocator.h>
|
||||
|
||||
LinearAllocator allocator(1024);
|
||||
|
||||
size_t before = allocator.GetUsedSize(); // 0
|
||||
|
||||
allocator.Allocate(128);
|
||||
allocator.Allocate(256);
|
||||
|
||||
size_t after = allocator.GetUsedSize(); // 384
|
||||
|
||||
void* marker = allocator.GetMarker();
|
||||
allocator.Allocate(64);
|
||||
size_t with_temp = allocator.GetUsedSize(); // 448
|
||||
|
||||
allocator.SetMarker(marker);
|
||||
size_t after_rollback = allocator.GetUsedSize(); // 384
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [LinearAllocator 总览](linear-allocator.md) - 返回类总览
|
||||
Reference in New Issue
Block a user