src/alloc.c


Log

Author Commit Date CI Message
Edward Thomson 305e801a 2018-10-21T09:52:32 util: allow callers to reset custom allocators Provide a utility to reset custom allocators back to their default. This is particularly useful for testing.
Carlos Martín Nieto 19007b19 2018-07-15T17:30:04 alloc: don't overwrite allocator during init if set If the allocator has been set before we the library is initialised, we would replace that setting with the standard allocator contrary to the user's wishes.
Patrick Steinhardt 74b7ddbf 2018-03-16T10:14:50 settings: allow swapping out memory allocator Tie in the newly created infrastructure for swapping out memory allocators into our settings code. A user can now simply use the new option "GIT_OPT_SET_ALLOCATOR" with `git_libgit2_opts`, passing in an already initialized allocator structure as vararg.
Patrick Steinhardt 9865cd16 2018-03-20T14:23:49 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.