Commit Graph

6 Commits

Author SHA1 Message Date
Edward Thomson
8aed4629b1 cmake: rename MSVC_CRTDBG to WIN32_LEAKCHECK 2020-11-21 21:54:13 +00:00
Edward Thomson
cb4b3bdf92 win32: "crtdbg" is now "leakcheck"
msvc crtdbg is a mouthfull that is not particularly indicative of what
it does.  Let's rename it to "win32 leakcheck".
2020-11-21 21:53:29 +00:00
lhchavez
4a0dceebe4 Make the Windows leak detection more robust
This change:

* Increases MY_ROW_LIMIT to 2M, since it has been failing in #5595's
  tests since it's _super_ close to the limit.
* Calls `git_repository_free()` on a `git_repository` that was being
  leaked only in Windows.
* Marks the global `git_repository` on `tests/repo/init.c` as `NULL`
  after being freed to make any accidental access more noisy.
* Uses `cl_assert_equal_i()` in `test_trace_windows_stacktrace__leaks`
  to make the test failures more actionable.
* Renames the globals in `tests/repo/init.c` so that they don't start
  with an underscore.
2020-10-11 18:31:05 -07:00
Patrick Steinhardt
a3afda9fb4 tests: trace: fix parameter type of aux callback
The function `git_win32__stack__set_aux_cb` expects the second parameter
to be a function callback of type `git_win32__stack__aux_cb_lookup`,
which expects a `size_t` parameter. In our test suite
trace::windows::stacktrace, we declare the callback with `unsigned int`
as parameter, though, causing a compiler warning.

Correct the parameter type to silence the warning.
2019-07-05 11:38:11 +02:00
Patrick Steinhardt
9865cd1696 alloc: make memory allocators use function pointers
Currently, our memory allocators are being redirected to the correct
implementation at compile time by simply using macros. In order to make
them swappable at runtime, this commit reshuffles that by instead making
use of a global "git_allocator" structure, whose pointers are set up to
reference the allocator functions. Like this, it becomes easy to swap
out allocators by simply setting these function pointers.

In order to initialize a "git_allocator", our provided allocators
"stdalloc" and "crtdbg" both provide an init function. This is being
called to initialize a passed in allocator struct and set up its members
correctly.

No support is yet included to enable users of libgit2 to switch out the
memory allocator at a global level.
2018-06-07 12:57:39 +02:00
Jeff Hostetler
93b4272895 Include stacktrace summary in memory leak output. 2015-06-29 16:39:11 -04:00