summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2023-02-10 18:54:08 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-15 21:58:01 +0000
commitd0b1e392cca66b2c5b399b0d3fe5a65f1068cd33 (patch)
tree7c958e6e17fd892ace7d5b718cc289d75787e4ae
parent2a294cfe9492fa44a9fe16a6adf1e945f63c7bcc (diff)
downloadmongo-d0b1e392cca66b2c5b399b0d3fe5a65f1068cd33.tar.gz
SERVER-71608 Add support to jscustomallocator.cpp for FreeBSD
(cherry picked from commit c419698b577f7924d2d6fc6bd3f7bd922f1d0dd7)
-rw-r--r--src/mongo/scripting/mozjs/jscustomallocator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/scripting/mozjs/jscustomallocator.cpp b/src/mongo/scripting/mozjs/jscustomallocator.cpp
index f8031f54ad2..28afb60fa88 100644
--- a/src/mongo/scripting/mozjs/jscustomallocator.cpp
+++ b/src/mongo/scripting/mozjs/jscustomallocator.cpp
@@ -43,6 +43,8 @@
#include <malloc/malloc.h>
#elif defined(_WIN32)
#include <malloc.h>
+#elif defined(__FreeBSD__)
+#include <malloc_np.h>
#else
#define MONGO_NO_MALLOC_USABLE_SIZE
#endif
@@ -183,7 +185,7 @@ size_t get_current(void* ptr) {
return 0;
return *reinterpret_cast<size_t*>(static_cast<char*>(ptr) - kMaxAlign);
-#elif defined(__linux__)
+#elif defined(__linux__) || defined(__FreeBSD__)
return malloc_usable_size(ptr);
#elif defined(__APPLE__)
return malloc_size(ptr);