SetMemoryBudget

Performance, document management

Description

Controls decoded-stream storage and the entry-count and decoded-byte budgets for compressed object-stream caching

Syntax

Delphi

Function TPDFlib.SetMemoryBudget(MaxDecodedStreamSize: Int64; ObjectStreamCacheSize: Integer): Integer; Overload;
Function TPDFlib.SetMemoryBudget(MaxDecodedStreamSize: Int64; ObjectStreamCacheSize: Integer; ObjectStreamCacheMaxBytes: Int64): Integer; Overload;

DLL

int DLSetMemoryBudget(int InstanceID, int64_t MaxDecodedStreamSize,
  int ObjectStreamCacheSize);

Parameters

MaxDecodedStreamSizeThe maximum decoded stream bytes retained in memory, or 0 for no limit
ObjectStreamCacheSizeThe maximum compressed object streams cached in memory, or 0 for the default of 50
ObjectStreamCacheMaxBytesThe maximum decoded object-stream payload and offset-table bytes cached per document, or 0 for no byte limit

Return values

1The limits were accepted and applied to existing and future documents
0A value was negative

Remarks

Call either overload before loading to set instance defaults for every later document

The two-parameter overload preserves the configured object-stream byte budget

Cached object streams use least-recently-used eviction, and a decoded object stream larger than the byte budget is read without entering the cache