SystemMemoryInfo class

A best-effort snapshot of the machine's total and currently-available physical memory, probed by shelling out to a short OS command (Process.runSync) — there is no portable Dart/dart:io API for this, and no reading at all is possible on a sandboxed mobile OS (iOS/Android don't expose system-wide memory to an app, and Process itself isn't available there).

probe never throws: any failure — an unsupported platform, a missing command, output in an unexpected shape — is treated the same as "no reading available" and produces null. Callers that need a memory budget regardless (see TiffAutoDecodeBudget) should always have a fixed fallback for that case.

Constructors

SystemMemoryInfo({required int totalBytes, required int availableBytes})
Holds one reading of the machine's memory.
const

Properties

availableBytes → int
Currently unused RAM plus RAM the OS could reclaim without swapping (e.g. macOS's inactive pages, Linux's MemAvailable) — a much more useful number than totalBytes for "how much can I safely claim right now", since most of totalBytes is normally already in use by the OS and other processes.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
totalBytes → int
Total physical RAM installed on the machine.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

probe({Duration maxAge = const Duration(seconds: 5)}) → SystemMemoryInfo?
Reads current system memory, or null if unavailable on this platform/right now (see the class doc comment). Shelling out on every call would be wasteful for a caller probing repeatedly in a short window, so a reading is reused for maxAge before this shells out again; pass Duration.zero to force a fresh read.