Skip to main content

Class: MemoryPressureMonitor

Samples the renderer's heap and tells its owner when to shed load.

This is the backstop under every individual queue cap: a bounded queue only protects against the growth path someone thought to bound, while a heap watchdog notices the ones nobody found. Sampling is pure and time-injected (MemoryPressureMonitor.sample) so the state machine is testable without timers, and a missing performance.memory degrades to a permanently steady monitor rather than a throw.

Constructors

constructor

new MemoryPressureMonitor(options?, readHeap?): MemoryPressureMonitor

Parameters

NameTypeDefault value
optionsPartial<MemoryPressureOptions>{}
readHeapHeapReaderreadChromiumHeap

Returns

MemoryPressureMonitor

Properties

options

Readonly options: MemoryPressureOptions

Methods

getStatus

getStatus(): MemoryPressureStatus

Returns

MemoryPressureStatus


sample

sample(nowMs): MemoryPressureVerdict

Parameters

NameType
nowMsnumber

Returns

MemoryPressureVerdict


start

start(onVerdict): void

Parameters

NameType
onVerdict(verdict: "shed" | "relieved", status: MemoryPressureStatus) => void

Returns

void


stop

stop(): void

Returns

void