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-14 18:05:25 +0000
commitc419698b577f7924d2d6fc6bd3f7bd922f1d0dd7 (patch)
tree3e905dee10f0eec3fb40ac7550a4192520b58540
parent5adf42d89dda28355ba5d60d755c0fbc89073208 (diff)
downloadmongo-c419698b577f7924d2d6fc6bd3f7bd922f1d0dd7.tar.gz
SERVER-71608 Add support to jscustomallocator.cpp for FreeBSD
-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);