Files
XCSDD/docs/api/resources/resourcecache/onmemorypressure.md

26 lines
497 B
Markdown
Raw Normal View History

# ResourceCache::OnMemoryPressure
```cpp
void OnMemoryPressure(size_t requiredBytes)
```
内存压力回调。当系统内存紧张时调用此方法,从 LRU 列表头部开始驱逐资源,直到释放足够空间。
**参数:**
- `requiredBytes` - 需要释放的字节数
**返回:** 无
**复杂度:** O(n)
**示例:**
```cpp
// 需要 100MB 空间
cache.OnMemoryPressure(100 * 1024 * 1024);
```
## 相关文档
- [ResourceCache 总览](resourcecache.md) - 返回类总览