sha1_file.c: introduce GIT_MMAP_LIMIT to limit mmap size
commita198eb7600a4fa2256355df18db5f1f5b8e43dd7
authorSteffen Prohaska <prohaska@zib.de>
Fri, 22 Aug 2014 14:01:21 +0000 (22 16:01 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Aug 2014 18:12:54 +0000 (22 11:12 -0700)
treefc811abe752bcffb31a67637c56d0c93cdbe0b6a
parent7ce7c7607b14248b1a3ae7cdd1c079eb3b6efa09
sha1_file.c: introduce GIT_MMAP_LIMIT to limit mmap size

Similar to testing expectations about malloc with GIT_ALLOC_LIMIT
introduced in d41489a6 (Add more large blob test cases, 2012-03-07),
it can be useful to test expectations about mmap.

Introduce a new environment variable GIT_MMAP_LIMIT to limit the
largest allowed mmap length (in KB).  xmmap() is modified to check
the limit.  Together with GIT_ALLOC_LIMIT tests can now easily
confirm expectations about memory consumption.

GIT_MMAP_LIMIT will be used in the next commit to test that data
will be streamed to an external filter without mmaping the entire
file.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c