This is an automated email from the ASF dual-hosted git repository.
zykkk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new cd8348dc5ba [Fix](memory) Fix allocator.h compiling failed on mac.
(#38562)
cd8348dc5ba is described below
commit cd8348dc5ba091d3edab1376613ee0d6f04bf00d
Author: Qi Chen <[email protected]>
AuthorDate: Wed Jul 31 17:08:53 2024 +0800
[Fix](memory) Fix allocator.h compiling failed on mac. (#38562)
Fix allocator.h compiling failed on mac which introduced by #37234.
---
be/src/vec/common/allocator.h | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/be/src/vec/common/allocator.h b/be/src/vec/common/allocator.h
index 88c85dceeb3..2bcce9a9c68 100644
--- a/be/src/vec/common/allocator.h
+++ b/be/src/vec/common/allocator.h
@@ -26,7 +26,14 @@
#if defined(USE_JEMALLOC)
#include <jemalloc/jemalloc.h>
#endif // defined(USE_JEMALLOC)
+
+#ifdef __APPLE__
+#include <malloc/malloc.h>
+#define GET_MALLOC_SIZE(ptr) malloc_size(ptr)
+#else
#include <malloc.h>
+#define GET_MALLOC_SIZE(ptr) malloc_usable_size(ptr)
+#endif
#include <stdint.h>
#include <string.h>
@@ -64,6 +71,14 @@
#define MAP_ANONYMOUS MAP_ANON
#endif
+#ifndef __THROW
+#if __cplusplus
+#define __THROW noexcept
+#else
+#define __THROW
+#endif
+#endif
+
static constexpr size_t MMAP_MIN_ALIGNMENT = 4096;
static constexpr size_t MALLOC_MIN_ALIGNMENT = 8;
@@ -106,7 +121,7 @@ public:
static constexpr bool need_record_actual_size() { return true; }
- static size_t allocated_size(void* ptr) { return malloc_usable_size(ptr); }
+ static size_t allocated_size(void* ptr) { return GET_MALLOC_SIZE(ptr); }
static int posix_memalign(void** ptr, size_t alignment, size_t size)
__THROW {
return ::posix_memalign(ptr, alignment, size);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]