aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAliaksey Kandratsenka <alkondratenko@gmail.com>2024-06-21 13:21:39 -0400
committerAliaksey Kandratsenka <alkondratenko@gmail.com>2024-06-21 13:32:35 -0400
commit469da8dac6c22cd4e2492a56babf09a895c60f27 (patch)
tree2272ccb09d731884e8b58c07dfb3ad0295a6cb4c
parent825b6638cf76aecc5a540d3fa662d157760fc11e (diff)
downloadgoogle-perftools-469da8dac6c22cd4e2492a56babf09a895c60f27.tar.gz
google-perftools-469da8dac6c22cd4e2492a56babf09a895c60f27.zip
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
-rw-r--r--src/windows/override_functions.cc8
1 files changed, 8 insertions, 0 deletions
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 @@ void* _recalloc(void* old_ptr, size_t n, size_t size) {
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 @@ size_t _msize(void* p) {
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() {