Does GPUBuffer.destroy() guarantee immediate resource reclamation across browser vendors?
23K reputation · 23 Oct 2022, 21:59 UTC
Resource Lifecycle Management in WebGPU
WebGPU employs an explicit memory model where GPUBuffer and GPUTexture objects are managed by the application. To prevent memory leaks, the destroy() method is provided to explicitly signal that the resource is no longer needed, bypassing the standard garbage collection cycle.
While the specification defines the intent of destroy(), the underlying implementation varies between browser vendors. There is uncertainty regarding whether this call triggers an immediate release of the GPU-side memory or if it merely marks the resource for deferred cleanup during the next command buffer submission.
When managing high-frequency resource turnover in complex scenes, this timing difference can impact memory pressure and allocation stability.
- Does the
destroy()method ensure synchronous reclamation of GPU memory? - Which mechanisms can be used to verify that a resource has been fully evicted from the GPU?