Table of Contents

Property ZeroBufferBehavior

Namespace
KZDev.PerfUtils
Assembly
KZDev.PerfUtils.dll

ZeroBufferBehavior

Setting for how buffers are zeroed out when memory is released.

public MemoryStreamSlimZeroBufferOption ZeroBufferBehavior { get; set; }

Property Value

MemoryStreamSlimZeroBufferOption

Remarks

By default, this setting is set to OutOfBand. To protect sensitive data, unused buffers are cleared when disposing the stream, but done out-of-band in the thread pool to help performance. In cases where you know that the stream does not contain any sensitive data that should not reside in memory after the MemoryStreamSlim instance is no longer in use, you can set this option to None, or for especially sensitive data and to force the zeroing to happen immediately inline as part of the release process, set it to OnRelease.

The zeroing of buffers can cause a performance overhead, especially when the stream is particularly large.