summaryrefslogtreecommitdiff
path: root/fitz/base_memory.c
AgeCommit message (Collapse)Author
2012-01-20Fix locking problems.Robin Watts
Thanks to filmor's help, fix some problems where locking was going wrong; in 2 cases we failed to unlock, and in 2 cases we tried to free (which relocks) while already locked. All simple fixes.
2012-01-19Multi-threading support for MuPDFRobin Watts
When we moved over to a context based system, we laid the foundation for a thread-safe mupdf. This commit should complete that process. Firstly, fz_clone_context is properly implemented so that it makes a new context, but shares certain sections (currently just the allocator, and the store). Secondly, we add locking (to parts of the code that have previously just had placeholder LOCK/UNLOCK comments). Functions to lock and unlock a mutex are added to the allocator structure; omit these (as is the case today) and no multithreading is (safely) possible. The context will refuse to clone if these are not provided. Finally we flesh out the LOCK/UNLOCK comments to be real calls of the functions - unfortunately this requires us to plumb fz_context into the fz_keep_storable function (and all the fz_keep_xxx functions that call it). This is the largest section of the patch. No changes expected to any test files.
2012-01-07Fix compilation warningsSebastian Rasmussen
Add missing newline and remove excessive arguments.
2011-12-15Add scavenging functionality.Robin Watts
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.
2011-12-08Stylistic changes when testing pointer values for NULL.Tor Andersson
Also: use 'cannot' instead of 'failed to' in error messages.
2011-10-04Reintroduce alloc context section.Robin Watts
This was removed during a previous commit to make the editing easier. Now added back in.
2011-10-04Move to exception handling rather than error passing throughout.Robin Watts
This frees us from passing errors back everywhere, and hence enables us to pass results back as return values. Rather than having to explicitly check for errors everywhere and bubble them, we now allow exception handling to do the work for us; the downside to this is that we no longer emit as much debugging information as we did before (though this could be put back in). For now, the debugging information we have lost has been retained in comments with 'RJW:' at the start. This code needs fuller testing, but is being committed as a work in progress.
2011-09-21Rename malloc functions for arrays (fz_calloc and fz_realloc).Tor Andersson
2011-09-20Reshuffle exception context code to fit Tor's aesthetic sense.Tor Andersson
2011-09-15Add context to mupdf.Robin Watts
Huge pervasive change to lots of files, adding a context for exception handling and allocation. In time we'll move more statics into there. Also fix some for(i = 0; i < function(...); i++) calls.
2011-04-04Le Roi est mort, vive le Roi!Tor Andersson
The run-together words are dead! Long live the underscores! The postscript inspired naming convention of using all run-together words has served us well, but it is now time for more readable code. In this commit I have also added the sed script, rename.sed, that I used to convert the source. Use it on your patches and application code.
2011-02-03Various patches from SumatraPDF.Tor Andersson
2011-02-03Special case calloc and realloc with zero count or size.Tor Andersson
2011-01-27Add fz_calloc function to check for integer overflow when allocating arrays, ↵Tor Andersson
and change the signature of fz_realloc to match.
2010-07-09Rearrange and merge some files in the fitz directory.Tor Andersson
2009-12-03Consolidate include lines to a single fitz.h.Tor Andersson
2009-11-20As a new code policy in MuPDF, malloc cannot return NULL. As a result we can ↵Tor Andersson
get rid of large chunks of untested error handling code. This patch cleans up the handling of fz_obj.
2009-04-26Get rid of that pesky warning about strdup not being available.Sebastian Rasmussen
2009-04-24Use the correct format specifier for size_t in fz_strdup.Ralph Giles
Prior to this patch, if the strdup failed, it would throw an error printing the number of bytes that could not be allocated. However, this was formatted as an int, while the actual argument passed is the return value of strdup itself, which is usually a size_t. This patch formats instead as an unsigned long, and adds a cast to ensure the types match even on platforms where this isn't already the case.
2009-03-11Rename and prune some files and functions.Tor Andersson
2009-03-11Add fz_catch function, and cause the throw/rethrow/catch functions to print ↵Tor Andersson
the errors immediately.
2009-02-28Merge and move header files into the source directories.Tor Andersson
2009-02-28Moved Fitz files into one directory.Tor Andersson
2005-06-04new world orderTor Andersson
2005-06-02metro package relationshipsTor Andersson
2005-03-30rename and shuffle -- part 2Tor Andersson