Age | Commit message (Collapse) | Author |
|
Function exists purely for doing valgrind testing of pixmap
definedness.
|
|
|
|
|
|
|
|
|
|
Previously this caused a memory leak.
|
|
m5-299787ea764c0a88bc481364eded5556.tif
|
|
|
|
|
|
|
|
|
|
In commit 6a8abce9603f69b57e407f0df4044be919f507d7 an
agnostic memory handler was introduced for libjpeg. While
this commit changed error_exit_dct() it forgot to make a
similar change in error_exit().
|
|
|
|
|
|
|
|
|
|
Part of the change in this code is to require opj_malloc
and co. Sadly, opj_malloc and co do not take a context field,
so a we need to wrap calls to openjpeg with a lock.
I am reusing the freetype lock here for simplicity.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Avoids gcc giving spurious warnings.
|
|
When reallocing set the rawsize before attempting to write
the post guard block.
|
|
Including: Bug 697134: Tweak MEMENTO_GS_HACKS inclusion.
Rather than rolling our own memset prototype in this case, use
the one that gs provides.
And, bug 697133: Fix typo in Memento.
Causing a significant slowdown. Thanks to George Burgess IV
for spotting this.
|
|
|
|
A few commits back, we introduced the fz_key_storable concept
to allow us to cope with objects that were used both as values
within the store and as parts of keys within the store.
This commit worked, but showed up performance problems; when the
store has several million PDF objects in it, bulk changes (such
as dropping a display list or document) could trigger many passes
across the store.
We therefore introduce a mechanism to ameliorate this. These
passes, now known as "reap passes", can be batched together using
fz_defer_reap_start and fz_defer_reap_end.
We trigger this start/end around display list dropping, and around
PDF content stream processing. This should be fine, as deferral
will be interrupted if we ever run our of memory during mallocing.
|
|
|
|
|
|
|
|
|
|
This is used at several places in mupdf.
|
|
|
|
|
|
|
|
If the same image is used repeatedly, then we currently send
the data again and again. Instead, send each image as a
reusable symbol and reuse it as required.
This reduces the size of the output by over 50% for the example
file, but unfortunately results in the example file killing
both Firefox and Edge when we attempt to load it. The file
seems entirely valid though, and this is a saving on sane files.
There is a #define that can be made to revert to the old
behaviour (SVG_SEND_REPEATED_IMAGES).
|
|
Now linear time rather than n^2.
|
|
The store is effectively a list of items, where each item is a
(key, value) pair. The design is such that we can easily get
into the state where the only reference to a value is that held
by the store. Subsequent references can then be generated by
things being 'found' from within the store.
While the only reference to an object is that held by it being
a value in the store, the store is free to evict it to save
memory.
Images present a complication to this design; images are stored
both as values within the store (by the pdf agent, so that we
do not regenerate images each time we meet them in the file),
and as parts of the keys within the store.
For example, once an image is decoded to give a pixmap, the
pixmap is cached in the store. The key to look that pixmap up
again includes a reference to the image from which the pixmap
was generated.
This means, that for document handlers such as gproof that do
not place images in the store, we can end up with images that
are kept around purely by dint of being used as references in
store keys. There is no chance of the value (the decoded pixmap)
ever being 'found' from the store as no one other than the
key is holding a reference to the image required. Thus the
images/pixmaps are never freed until the store is emptied.
This commit offers a fix for this situation.
Standard store items are based on an fz_storable type. Here we
introduce a new fz_key_storable type derived from that. As well
as keeping track of the number of references a given item has
to it, it keeps a separate count of the number of references a
given item has to it from keys in the store.
On dropping a reference, we check to see if the number of
references has become the same as the number of references from
keys in the store. If it has, then we know that these keys can
never be 'found' again. So we filter them out of the store,
which drops the items.
|
|
This is useful when a TIFF image is grayscale but
supplies more than a single component per sample.
|
|
This makes debugging much simpler.
|
|
We call Memento_addRef etc in fz_keep_impXX functions, so
don't call them in the callers too.
|
|
Getting a backtrace out with missing functions makes the
backtrace much less useful. Some backtrace routines (such
as that used by Memento on Android) are incapable of
resolving static functions.
We therefore provide 2 scripts (scripts/destatic.sh and
scripts/restatic.sh) that respectively remove and replace
the 'static' from function definitions.
The scripts do not affect "static inline" or "static const"
definitions, and they are are restricted to working in the
source directory (excluding source/tools), thirdparty/mujs
and the platform/{java,android} directories.
The transformed source should NOT be checked in.
To avoid problems with clashing symbols, some functions are
renamed or tweaked slightly in this patch.
|