override_functions: add _{msize,recalloc}_base
Apparently modern ucrt does have _msize_base and _recalloc_base
defined in same .obj files as their corresponsing "non-base"
functions. And they're seemingly used somewhere in their C or C++
runtime. So lets provide them too in our override_functions.cc, so
that overriding malloc routines in MSVC's static C runtime option
works.
Otherwise, whatever msize_base usage pulls msize.obj file that wants
to define regular msize, and with msize already provided by
override_function, we'd rightfully get linking error.
Update github ticket
https://github.com/gperftools/gperftools/issues/1430
diff --git a/src/windows/override_functions.cc b/src/windows/override_functions.cc
index 8afb851..657bb84 100644
--- a/src/windows/override_functions.cc
+++ b/src/windows/override_functions.cc
@@ -87,6 +87,10 @@
return new_ptr;
}
+void* _recalloc_base(void* old_ptr, size_t n, size_t size) {
+ return _recalloc(old_ptr, n, size);
+}
+
void* _calloc_impl(size_t n, size_t size) {
return calloc(n, size);
}
@@ -95,6 +99,10 @@
return MallocExtension::instance()->GetAllocatedSize(p);
}
+size_t _msize_base(void* p) noexcept {
+ return MallocExtension::instance()->GetAllocatedSize(p);
+}
+
HANDLE __acrt_heap = nullptr;
bool __acrt_initialize_heap() {