THotPDF Windowed Local File Mapping

Controls the bounded read-only memory mapping used by LoadFromFile for large local documents

Declarations

property LocalFileMappingThreshold: Int64;
property LocalFileMappingWindowSize: Integer;
property LocalFileMappingCacheWindows: Integer;
property LocalFileMappingAdaptiveGeometry: boolean;
property LastLoadUsedMemoryMapping: boolean;

function GetLastMappedFileStatistics(
  out Statistics: THPDFMappedFileStatistics): boolean;

Defaults

SettingDefaultMeaning
LocalFileMappingThreshold8 MiBMinimum source size that selects memory mapping; zero disables mapping
LocalFileMappingWindowSize16 MiBBytes covered by one allocation-granularity-aligned view
LocalFileMappingCacheWindows4Maximum resident views retained by the LRU cache
LocalFileMappingAdaptiveGeometryTrueRedistribute the same mapped-byte limit for sustained sequential or random access

Statistics

THPDFMappedFileStatistics = record
  FileSize: Int64;
  ConfiguredWindowSize: Int64;
  ConfiguredCacheWindowCount: Integer;
  WindowSize: Int64;
  CacheWindowCount: Integer;
  MappedByteLimit: Int64;
  CurrentMappedBytes: Int64;
  PeakMappedBytes: Int64;
  GeometryChangeCount: Int64;
  SequentialReadCalls: Int64;
  RandomReadCalls: Int64;
  AdaptiveGeometry: Boolean;
  SequentialGeometryActive: Boolean;
  RandomGeometryActive: Boolean;
  ReadCalls: Int64;
  BytesRead: Int64;
  MapCount: Int64;
  CacheHits: Int64;
  FallbackReadCalls: Int64;
  FallbackBytes: Int64;
  DirectTransferCalls: Int64;
  DirectTransferBytes: Int64;
end;

GetLastMappedFileStatistics returns True only when the last LoadFromFile operation selected mapping

MapCount counts new views and CacheHits counts reads served by an existing view, allowing applications and benchmarks to tune window geometry against real access patterns

MappedByteLimit remains fixed while WindowSize and CacheWindowCount report the active geometry; peak mapped bytes, pattern counts, and mode flags make every adaptation observable

Advanced source types

THPDFMappedFileSource owns the shared file handle, mapping object, synchronized LRU windows, reference count, and positional fallback path

THPDFMappedFileStream exposes a bounded seekable slice over that source, while THPDFMappedFileWindow describes one cached internal view

Behaviour

See also: LocalFileMappingAdaptiveGeometry, LoadFromFile, Scalable Loading, HPDFTransferStream, LoadedStreamMemoryThreshold