MemoryPressureRelease class
Wraps child and gives renderer's pooled targets back when the platform warns about memory.
What the pool does without this is settle at a high-water mark and stay there. It keeps one texture of every attachment shape any frame has ever needed: turn bloom on once and its five levels are held for the rest of the session, take one screenshot at twice the window size and that pair is held too. On a desktop that is a megabyte nobody notices. On a phone the process is killed, which is a crash class rather than a slow frame — and it arrives as a report with no Dart stack, because the operating system did it.
Wired to the platform's own warning rather than to a budget. A budget
means this package deciding how many megabytes a game may hold on a device
it knows nothing about, and being wrong in both directions.
didHaveMemoryPressure is the one signal that is actually about this
device, at this moment, with these other applications running.
What the next frame pays is one round of allocation, once. What is lent out is left alone, so a frame in flight keeps the targets it is drawing into.
MemoryPressureRelease(
renderer: renderer,
child: SceneSurface(renderer: renderer, /* … */),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MemoryPressureRelease
Constructors
- MemoryPressureRelease({required Renderer renderer, required Widget child, void onReleased()?, Key? key})
-
const
Properties
- child → Widget
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onReleased → void Function()?
-
Called after the release, for an application that logs it.
final
- renderer → Renderer
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MemoryPressureRelease> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited