Gpu 0.1.0 devicetokenhashes dispose - CyrilB1531/lodestar GitHub Wiki
Lodestar.Gpu 0.1.0. This page is frozen at that release. Read the current documentation for what
mainsays now. A link to a decision or a migration page followsmain, and leaves the archive.
DeviceTokenHashes.Dispose
Frees the two device buffers.
public void Dispose()
Example — the shape a caller writes.
using Lodestar.Gpu.Compute;
using var context = GpuContext.Create(preferCpu: true);
using var resident = DeviceTokenHashes.Upload(context, [1u, 2u](/CyrilB1531/lodestar/wiki/1u,-2u));
int held = resident.Count; // => 1
Remarks — the hashes and their offsets go together: the offsets alone cannot cut a batch that is no longer there.
using is the intended spelling. Device memory is not reclaimed by the garbage collector, so a
block that is dropped rather than disposed stays allocated on the accelerator until the process
ends.
Applies to — net10.0, netstandard2.1.
See also — DeviceTokenHashes.