diff options
author | Karsten Blees <blees@dcon.de> | 2014-07-17 17:38:03 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-07-21 09:32:50 -0700 |
commit | 6f1c189cadd7c18c03138070324af02563c0b0d1 (patch) | |
tree | 90f3265b739c4a5f706a9d3f1b0d29fadbeac5fa /thread-utils.c | |
parent | Win32: reduce environment array reallocations (diff) | |
download | tgif-6f1c189cadd7c18c03138070324af02563c0b0d1.tar.xz |
Win32: use low-level memory allocation during initialization
As of d41489a6 "Add more large blob test cases", git's high-level memory
allocation functions (xmalloc, xmemdupz etc.) access the environment to
simulate limited memory in tests (see 'getenv("GIT_ALLOC_LIMIT")' in
memory_limit_check()). These functions should not be used before the
environment is fully initialized (particularly not to initialize the
environment itself).
The current solution ('environ = NULL; ALLOC_GROW(environ...)') only works
because MSVCRT's getenv() reinitializes environ when it is NULL (i.e. it
leaves us with two sets of unusabe (non-UTF-8) and unfreeable (CRT-
allocated) environments).
Add our own set of malloc-or-die functions to be used in startup code.
Also check the result of __wgetmainargs, which may fail if there's not
enough memory for wide-char arguments and environment.
This patch is in preparation of the sorted environment feature, which
completely replaces MSVCRT's getenv() implementation.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'thread-utils.c')
0 files changed, 0 insertions, 0 deletions