diff options
author | Jeff Hostetler <jeffhost@microsoft.com> | 2019-06-25 07:49:40 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-06-25 10:46:57 -0700 |
commit | 556702f86cb043f18bf46dceec25fe1e783c4590 (patch) | |
tree | 79bfbdf11c7c3b20f31113abf4e6f4704b4865ea /compat | |
parent | msvc: support building Git using MS Visual C++ (diff) | |
download | tgif-556702f86cb043f18bf46dceec25fe1e783c4590.tar.xz |
msvc: add a compile-time flag to allow detailed heap debugging
MS Visual C comes with a few neat features we can use to analyze the
heap consumption (i.e. leaks, max memory, etc).
With this patch, we introduce support via the build-time flag
`USE_MSVC_CRTDBG`.
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r-- | compat/mingw.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c index c063ae62be..667285887a 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2411,6 +2411,12 @@ int wmain(int argc, const wchar_t **wargv) trace2_initialize_clock(); +#ifdef _MSC_VER +#ifdef USE_MSVC_CRTDBG + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); +#endif +#endif + maybe_redirect_std_handles(); /* determine size of argv and environ conversion buffer */ |