# D3D12CommandAllocator::~D3D12CommandAllocator ```cpp ~D3D12CommandAllocator(); ``` 析构函数,自动调用 [`Shutdown`](shutdown.md) 释放底层 D3D12 资源。 ## 示例 ```cpp { D3D12CommandAllocator allocator; allocator.Initialize(device); // 使用分配器 } // 离开作用域时析构函数自动调用 Shutdown ``` ## 相关文档 - [D3D12CommandAllocator 总览](command-allocator.md) - 返回类总览 - [D3D12CommandAllocator::Shutdown](shutdown.md) - 关闭分配器