DVPlatformMemory class final
An arena over a preallocated memory budget.
The budget is reserved when the arena is constructed, in fixed power-of-two segments, and never grows. Scalars and lists are placed one after another; reset makes the whole arena reusable at once and invalidates everything handed out before it, and dispose gives it up.
Construct it directly, or through DV.Memory.allocate, which applies the
configured defaults and ceilings and registers the arena for diagnostics.
- Implemented types
Constructors
- DVPlatformMemory({_I? gigabytes, _I? megabytes, DVMemoryProfile? profile, DVSize? segment, _B? touchPages, DVMemoryTarget? target, DVMemoryBacking? backing})
-
Reserves
gigabytesormegabytes(not both) in segments ofsegment, which must be a power of two. - DVPlatformMemory.configured({DVSize? asked, DVMemoryProfile? profile, DVSize? segment, _B? touchPages, DVMemoryTarget? target, DVMemoryBacking? backing, DVSize? ceiling, String? ceilingSource, _I id = 0})
-
The constructor
DV.Memory.allocateuses once configuration is applied.
Properties
- askedBytes ↔ int
-
What was asked for, before any ceiling.
latefinal
-
diagnostics
→ List<
DVMemoryDiagnostic> -
What this arena recorded while it was set up.
no setter
- fragmentedBytes → int
-
Bytes skipped since the last reset: a segment's unused tail when the
next allocation did not fit in it, and alignment padding.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- highWaterBytes → int
-
The most usedBytes has been, across resets.
no setter
- id → int
-
The registry id
DV.Memorygave this arena; 0 when constructed directly.final - isDisposed → _B
-
no setter
- isLent → _B
-
Whether a worker holds this arena (
DV.Workers.run(..., lend: [arena])).no setter - resetCount → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- securedBytes → int
-
The capacity actually granted. Size workloads from this, not from what
was asked: preallocation is best-effort.
no setter
- segmentBytes ↔ int
-
The size of one full segment.
latefinal
- segmentCount → int
-
no setter
- target → DVMemoryTarget
-
The target this arena was sized for.
final
- usedBytes → int
-
Bytes handed out since the last reset.
no setter
Methods
-
bool(
_B value) → DVBool -
A bool scalar, initialised to
value. -
dispose(
) → void - Gives the arena up. Everything it handed out is invalidated; native segments return to the platform once nothing holds a view of them.
-
double(
_D value) → DVDouble -
A double scalar, initialised to
value. -
doubleList(
_I length) → MemorySlice< _D> - Doubles, stored as float64.
-
float32(
_I length) → MemorySlice< _D> -
float64(
_I length) → MemorySlice< _D> -
giveBack(
) → void -
Marks it returned.
override
-
int(
_I value) → DVInt -
An integer scalar, initialised to
value. -
int16(
_I length) → MemorySlice< _I> -
int32(
_I length) → MemorySlice< _I> -
int64(
_I length) → MemorySlice< _I> -
int64 storage. Refused on web-js, where there is none
(
DV-MEMORY-003); use intList, int32 or float64 there. -
int8(
_I length) → MemorySlice< _I> -
intList(
_I length) → MemorySlice< _I> - Integers in the widest storage the target holds exactly: int64 on native and web-wasm, float64 on web-js (exact to 2^53).
-
lend(
) → void -
Marks the arena held by a worker, which is given its addresses.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rawBytes(
_I length) → Uint8List - Raw bytes for binary interop, contiguous within one segment.
-
rawStruct(
_I byteLength) → ByteData - A ByteData view for a binary struct, contiguous within one segment. Not invalidated by reset, as rawBytes.
-
reset(
) → void - Makes the whole arena reusable. Every scalar and slice handed out before this is invalidated and throws StateError when touched.
-
toString(
) → String -
A string representation of this object.
inherited
-
uint16(
_I length) → MemorySlice< _I> -
uint32(
_I length) → MemorySlice< _I> -
uint8(
_I length) → MemorySlice< _I>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited