Age | Commit message (Collapse) | Author |
|
A couple of bits of the code SEGV in the event that values are NULL.
Fixed here by converting a do...while to a while, and adding an extra
guard in the if.
Thanks to Gaetan Bisson for the report, and patch.
|
|
|
|
|
|
Hadn't been updated to allow for context/exceptions.
|
|
One of the previous memsqueezing fixes (specifically that in
close_dctd) appears to cause the Memento fork bases squeezing
process to stop.
This appears to be because old code would do a NULL dereference
causing a SEGV. This would somehow NOT be picked up by the signal
handler, and the child would exit.
If the code is fixed to avoid the SEGV the code then somehow
goes on to do something (not in the close_dctd code) that makes
the mem squeeze process grind to a halt - but NOT in the same
instance of the executable. I am at a loss to explain this, but
would rather the code stays as it is (being as far as I can see
correct) for now.
|
|
|
|
Disabled for now by default.
Better SEGV handling under windows (to facilitate scripted squeezing)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rather than passing a stream to a close function, just pass context
and state - that's all that is required. This enables us to
call close to cleanup neatly if the stream fails to allocate.
|
|
|
|
Mupdf has some large structures (fz_shade is over 32K!), so to catch
all pointers we need to search further than the 1K I was originally
limiting ourselves to.
|
|
|
|
Missed this one last time.
|
|
|
|
|
|
|
|
|
|
The new fz_malloc_struct(A,B) macro allocates sizeof(B) bytes using
fz_malloc, and then passes the resultant pointer to Memento_label
to label it with "B".
This costs nothing in non-memento builds, but gives much nicer
listings of leaked blocks when memento is enabled.
|
|
|
|
When listing blocks from Memento, look for internal pointers to
other blocks, and use this to generate a nested list - much
easier to read when looking to see which stray reference is
causing blocks to leak.
Add new Memento_label feature to allow blocks to be labelled. Makes
block displaying much easier to read.
|
|
|
|
|
|
|
|
Slight memento tweak to simplify code (and correct problem with
repeated event numbers when squeezing).
|
|
|
|
Fixes for leaks (and SEGVs, division by zeros etc) seen when
Memsqueezing.
|
|
Fix warnings/errors thrown up by the last few commits (which were
only tested on windows).
|
|
The substitute fonts used in a fontdesc are held in ROM, and as such
should not count towards the size of a fontdesc. Simple fix; remove
the lines that adds that in.
|
|
When fz_malloc (etc) are about to fail, we try to scavenge memory
from the store and then retry. We repeatedly try to bin objects
from the store until the malloc succeeds, or until we have nothing
else to bin.
This means we no longer need the 'aging' of the store, so this is
removed.
|
|
New Memento feature that enables us to easily test scavenging.
|
|
Memento_listBlocks and Memento_listNewBlocks.
|
|
|
|
Change the fz_store to be limited to 256 Megs. Remove the soft limit
for pixmaps; the store will automatically throw old resources away
to stay below the limit.
|
|
Firstly, we rename pdf_store to fz_store, reflecting the fact that
there are no pdf specific dependencies on it.
Next, we rework it so that all the objects that can be stored in
the store start with an fz_storable structure. This consists of
a reference count, and a function used to free the object when
the reference count reaches zero.
All the keep/drop functions are then reimplemented by calling
fz_keep_sharable/fz_drop_sharable. The 'drop' functions as supplied
by the callers are thus now 'free' functions, only called if
the reference count drops to 0.
The store changes to keep all the items in the store in the linked
list (which becomes a doubly linked one). We still make use of
the hashtable to index into this list quickly, but we now have
the objects in an LRU ordering within the list.
Every object is put into the store, with a size record; this is
an estimate of how much memory would be freed by freeing that
object.
The store is moved into the context and given a maximum size;
when new things are inserted into the store, care is taken to
ensure that we do not expand beyond this size. We evict any
stored items (that are not in use) starting from the least
recently used.
Finding an object in the store now takes a reference to it already.
LOCK and UNLOCK comments are used to indicate where locks need to
be taken and released to ensure thread safety.
|
|
Update pdfclean with some new decompression options; -d changes it's
definition (though not it's behaviour) to mean "decompress all
streams".
New flags, -i and -f toggle the decompression of image and font streams
respectively.
|
|
|
|
When adding the exception handling in, I'd mis-indented some code.
This caused all the file to be read.
|
|
|
|
|
|
Also: use 'cannot' instead of 'failed to' in error messages.
|
|
|
|
|
|
|
|
|
|
|