Peak Memory Scheduling

HotPDF admits competing high-footprint operations through one process-wide byte budget before they allocate their main working sets

Covered operations

Each operation reserves a conservative estimate derived from its source size, render dimensions, DPI, stream threshold, and worker count, then releases the reservation at the existing operation telemetry boundary

Admission policy

The uncontended path allocates no wait event, whilst contended operations use one private event and do not spin

Configuration

PDF.PeakMemorySchedulerEnabled := True;
PDF.PeakMemorySchedulerBudgetBytes := 768 * 1024 * 1024;

PDF.ResetPeakMemorySchedulerStatistics;
if PDF.GetPeakMemorySchedulerStatistics(Stats) then
begin
  WriteLn(Stats.PeakReservedBytes);
  WriteLn(Stats.DelayedAdmissionCount);
  WriteLn(Stats.TotalWaitMilliseconds);
end;

PeakMemorySchedulerEnabled is per component and can bypass admission for trusted isolated work, whilst PeakMemorySchedulerBudgetBytes configures the shared process-wide scheduler

Statistics

THPDFPeakMemorySchedulerStatistics reports current and peak reserved bytes, current and peak active reservations, current and peak waiters, total and delayed admissions, oversized admissions, cancellations, and aggregate wait time

THPDFOperationTelemetry.ScheduledMemoryBytes, MemorySchedulerWaitMilliseconds, and MemorySchedulerDelayed attribute scheduling cost to the most recent operation

Related APIs