Table of Contents

Class MemoryScan

Namespace
CStructSharp.Memory
Assembly
CStructSharp.dll

Deterministic bounded scan transport over caller-supplied ranges, independent of candidate interpretation.

public static class MemoryScan
Inheritance
MemoryScan
Inherited Members

Methods

Run(IEnumerable<MemoryRegion>, MemoryScanVisitor, MemoryAccessContext, int, int, int, int, int)

Streams known windows, reusing context bytes and retaining later islands after unavailable reads.

public static MemoryScanResult Run(IEnumerable<MemoryRegion> ranges, MemoryScanVisitor visitor, MemoryAccessContext context, int windowBytes = 1048576, int overlapBytes = 0, int unavailableStride = 1, int maxWindows = 1000000, int maxRanges = 100000)

Parameters

ranges IEnumerable<MemoryRegion>

Explicit finite logical ranges, with caller-owned sources.

visitor MemoryScanVisitor

Synchronous borrowed-window callback. It must enforce candidate/hit/result limits.

context MemoryAccessContext

Shared CPU, translation and transport budget; cancellation always propagates.

windowBytes int

Owned candidate-start bytes per full window, between 1 and 64 MiB.

overlapBytes int

Context on either side, at most windowBytes. Complete candidates must fit the chosen context bound.

unavailableStride int

Explicit unavailable-unit size in bytes, aligned to logical coordinates.

maxWindows int

Maximum callbacks, also bounding retained consumer work.

maxRanges int

Maximum supplied ranges, before coalescing.

Returns

MemoryScanResult

Coverage and explicit completion reason. Exhausted ranges can still contain unavailable coverage.

Remarks

Ranges are supplied in desired order. Adjacent ranges in the same source are continuous; overlapping or descending adjacent ranges in that source are rejected. Unknown intervals break continuity. A positive short read is retried. UnavailableStride explicitly permits skipping to the next aligned unit after a failed byte; use 1 for arbitrary byte-level holes or the source's known page granularity. Coverage counts that whole skipped unit as unavailable. Align candidates using window.Address, not buffer offset zero.

Exceptions

ArgumentOutOfRangeException

Limits or scratch sizes are invalid.

ArgumentException

Neighboring ranges in one source overlap or descend.

MemoryAccessException

The shared budget is exhausted.

OperationCanceledException

Cancellation was requested.