Cross-Reference Map Paging

When a document's cross-reference map grows past THotPDF.XRefMapPagingThreshold entries (default 250000, roughly 8 MB dense), the load-complete pass packs it into THPDFXRefMapPager and releases the dense array, so large documents stop retaining every entry in an aligned record map

THPDFXRefMapPager

The pager stores a sorted snapshot of packed 24-byte slots (THPDFXRefMapSlot): object number, entry type, 16-bit generation, offset, and object-stream location. GetEntry answers by binary search through a small LRU-materialized 64-entry page, so sequential lookups decode one page for many entries; CollectFreeEntries extracts the free set in object-number order for the incremental-update rebuild

Diagnostics and Consumers

GetLoadedXRefMapPaged reports the paged state with entry count, snapshot bytes, and window hit or miss counts; the incremental-save free-set rebuild and the indirect /Length resolution of lazily materialized stream members answer through the pager, and setting the threshold to 0 disables paging entirely