summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2014-11-25 19:57:29 +0000
committerRobin Watts <robin.watts@artifex.com>2014-11-26 11:24:30 +0000
commite767bd783d91ae88cd79da19e79afb2c36bcf32a (patch)
treeae0544ae1641fdd9efdbd608ad0bf0b8618669ec /platform
parent37779f92eda4a7adf4b0f0212f89680beca77c5c (diff)
downloadmupdf-e767bd783d91ae88cd79da19e79afb2c36bcf32a.tar.xz
Change xref representation to cope better with sparse xrefs.
Currently each xref in the file results in an array from 0 to num_objects. If we have a file that has been updated many times this causes a huge waste of memory. Instead we now hold each xref as a list of non-overlapping subsections (exactly as the file holds them). Lookup is therefore potentially slower, but only on files where the xrefs are highly fragmented (i.e. where we would be saving in memory terms). Some parts of our code (notably the file writing code that does garbage collection etc) assumes that lookups of object entry pointers will not change previous object entry pointers that have been looked up. To cope with this, and to cope with the case where we are updating/creating new objects, we introduce the idea of a 'solid' xref. A solid xref is one where it has a single subsection record that spans the entire range of valid object numbers for a file. Once we have ensured that an xref is 'solid', we can safely work on the pointers within it without fear of them moving. We ensure that any 'incremental' xref is solid. We also ensure that any non-incremental write makes the xref solid.
Diffstat (limited to 'platform')
0 files changed, 0 insertions, 0 deletions