summaryrefslogtreecommitdiff
path: root/source/fitz/memento.c
AgeCommit message (Collapse)Author
2016-03-28Memento: Add facility to cope with 'known' leaked blocks.Robin Watts
Harfbuzz allocates blocks that it keeps around as statics. There are a finite number of these, and they are never freed (at least not in the build we use). Having Memento report them as leaks is a pain. So we extend Memento so that we can label blocks as being leaks, and thus never have to be bothered by them.
2016-03-26Memento: Cope with wrapped blocks.Robin Watts
If another routine 'wraps' memento blocks (such as a chunk allocator or the 'trace' allocator in mudraw), then the address passed to Memento_label, Memento_takeRef etc, can be inside the block rather than at the start of the block. Update Memento to cope with this.
2016-03-23Tweak Memento to avoid suprious valgrind warnings.Robin Watts
2016-03-15Memento: Avoid warnings building without HAVE_LIBDLRobin Watts
2016-03-15Memento: Rename memento 'globals' to 'memento'.Robin Watts
Neatness.
2016-03-15Memento: Add Memento_{takeRef,dropRef,reference} functions.Robin Watts
These work with MEMENTO_DETAILS to allow us to store the events where reference counts change.
2016-03-10Memento: Pull in latest fixes from gs.Robin Watts
2016-03-07Memento: List block details at closedown.Robin Watts
2016-03-07Memento: Store/display backtraces with blocks.Robin Watts
If built with MEMENTO_DETAILS (on by default), we store the backtrace on every event that affects a block. Memento_details(address) will display the events that affected a block (typically malloc, {realloc}*, free), including the backtrace at each point. Windows and linux use different mechanisms for this. Windows loads a DLL and calls windows specific functions - no extra libraries are required. Linux also loads a shared object (libbacktrace.so). This is not present on all platforms, so on platforms where it is not available we just get addresses. These can be converted using addr2line (unless ASLR is enabled). In order for linux to be able to load libbacktrace.so we link in libdl. If this is not available, define HAVE_LIBDL=no when building the memento target.
2016-03-07Memento: Store callstacks for events.Robin Watts
Add Memento_info(address) that will show the details of a block (callstacks when it was allocatd, realloced, freed etc). This works on MSVC and GNUC using two different methods.
2016-03-03Memento: Speed improvements.Robin Watts
Avoid searching the linked list of blocks in order to remove a block by moving to a doubly linked list. This can be done without increasing the amount of memory in use by making better use of the 'parent' pointer that is only used when displaying nested blocks. Also store magic values in the 'child' and 'sibling' pointers (again only used when displaying nested blocks) so that we can quickly verify that a block is real before doing too much with it. Those changes drastically reduce the time required for MEMENTO_LEAKONLY runs (now the same order of magnitude as non memento runs). Normal memento runs are still very slow when the numbers of blocks increase due to the paranoid checking taking time. To ameliorate this a bit, we try 2 other things. Firstly, we optimise the searching of blocks by making use of int aligned tests. This still doesn't make much difference. Secondly, we introduce a new mechanism for the 'paranoia' levels. If a negative number is given for the paranoia level (say -n) then we first perform our overwrite checks after n events. We next test after 2n events, then 4n, then 8n etc. The new default paranoia level is set to be -1024. This makes a huge difference, and brings normal memento runs down to be comparable with debug runs.
2015-05-15Memento improvements.Robin Watts
Firstly, when displaying a list of nested blocks, don't suppress outputting a block just because it contains a pointer to itself. Various valgrind fixes from the gs version of memento. Experimental C++ operators. See writeup in memento.h comments for how to integrate.
2015-02-25Add 64 bit windows builds to MSVC solution.Robin Watts
A few casts are required within the code, along with a few #ifdef changes. Some tweaks to curl are required too.
2014-01-17Fix more Memento/Valgrind interactions.Robin Watts
Seen when valgrinding a memento build of mudraw on: e0e44ed8692671b820de72c6c0a32608_asan_heap-uaf_8c2b76_1530_2026.pdf
2014-01-13Memento fixes for working with valgrind.Robin Watts
Remember to make blocks defined before writing/reading them.
2013-07-03Update Memento to output to debug window on windows.Robin Watts
Windows is stupid and doesn't display stderr/stdout in the debugger. Update Memento so that messages will appear there too.
2013-06-20Rearrange source files.Tor Andersson