Commit e9df6f79 authored by Qinfan Wu's avatar Qinfan Wu Committed by facebook-github-bot-1

Add sdallocx for jemalloc

Summary: Make jemalloc's sdallocx function available in folly and allow future code to
use sized deallocation.

Reviewed By: elsteveogrande, ot

Differential Revision: D2687746

fb-gh-sync-id: 9ef8a16d2c63c4eb8cecab7639add423ef093c2d
parent 442584e7
...@@ -73,6 +73,8 @@ extern "C" size_t sallocx(const void*, int) ...@@ -73,6 +73,8 @@ extern "C" size_t sallocx(const void*, int)
__attribute__((__weak__)); __attribute__((__weak__));
extern "C" void dallocx(void*, int) extern "C" void dallocx(void*, int)
__attribute__((__weak__)); __attribute__((__weak__));
extern "C" void sdallocx(void*, size_t, int)
__attribute__((__weak__));
extern "C" size_t nallocx(size_t, int) extern "C" size_t nallocx(size_t, int)
__attribute__((__weak__)); __attribute__((__weak__));
extern "C" int mallctl(const char*, void*, size_t*, void*, size_t) extern "C" int mallctl(const char*, void*, size_t*, void*, size_t)
...@@ -137,9 +139,9 @@ inline bool usingJEMalloc() noexcept { ...@@ -137,9 +139,9 @@ inline bool usingJEMalloc() noexcept {
// in the form if (mallctl != nullptr). Not if (mallctl) or if (!mallctl) // in the form if (mallctl != nullptr). Not if (mallctl) or if (!mallctl)
// (!!). http://goo.gl/xpmctm // (!!). http://goo.gl/xpmctm
if (mallocx == nullptr || rallocx == nullptr || xallocx == nullptr if (mallocx == nullptr || rallocx == nullptr || xallocx == nullptr
|| sallocx == nullptr || dallocx == nullptr || nallocx == nullptr || sallocx == nullptr || dallocx == nullptr || sdallocx == nullptr
|| mallctl == nullptr || mallctlnametomib == nullptr || nallocx == nullptr || mallctl == nullptr
|| mallctlbymib == nullptr) { || mallctlnametomib == nullptr || mallctlbymib == nullptr) {
return false; return false;
} }
......
...@@ -29,6 +29,7 @@ void* rallocx(void*, size_t, int) __attribute__((__weak__)); ...@@ -29,6 +29,7 @@ void* rallocx(void*, size_t, int) __attribute__((__weak__));
size_t xallocx(void*, size_t, size_t, int) __attribute__((__weak__)); size_t xallocx(void*, size_t, size_t, int) __attribute__((__weak__));
size_t sallocx(const void*, int) __attribute__((__weak__)); size_t sallocx(const void*, int) __attribute__((__weak__));
void dallocx(void*, int) __attribute__((__weak__)); void dallocx(void*, int) __attribute__((__weak__));
void sdallocx(void*, size_t, int) __attribute__((__weak__));
size_t nallocx(size_t, int) __attribute__((__weak__)); size_t nallocx(size_t, int) __attribute__((__weak__));
int mallctl(const char*, void*, size_t*, void*, size_t) int mallctl(const char*, void*, size_t*, void*, size_t)
__attribute__((__weak__)); __attribute__((__weak__));
...@@ -41,6 +42,7 @@ extern void* (*rallocx)(void*, size_t, int); ...@@ -41,6 +42,7 @@ extern void* (*rallocx)(void*, size_t, int);
extern size_t (*xallocx)(void*, size_t, size_t, int); extern size_t (*xallocx)(void*, size_t, size_t, int);
extern size_t (*sallocx)(const void*, int); extern size_t (*sallocx)(const void*, int);
extern void (*dallocx)(void*, int); extern void (*dallocx)(void*, int);
extern void (*sdallocx)(void*, size_t, int);
extern size_t (*nallocx)(size_t, int); extern size_t (*nallocx)(size_t, int);
extern int (*mallctl)(const char*, void*, size_t*, void*, size_t); extern int (*mallctl)(const char*, void*, size_t*, void*, size_t);
extern int (*mallctlnametomib)(const char*, size_t*, size_t*); extern int (*mallctlnametomib)(const char*, size_t*, size_t*);
......
...@@ -24,6 +24,7 @@ void* (*rallocx)(void*, size_t, int) = nullptr; ...@@ -24,6 +24,7 @@ void* (*rallocx)(void*, size_t, int) = nullptr;
size_t (*xallocx)(void*, size_t, size_t, int) = nullptr; size_t (*xallocx)(void*, size_t, size_t, int) = nullptr;
size_t (*sallocx)(const void*, int) = nullptr; size_t (*sallocx)(const void*, int) = nullptr;
void (*dallocx)(void*, int) = nullptr; void (*dallocx)(void*, int) = nullptr;
void (*sdallocx)(void*, size_t, int) = nullptr;
size_t (*nallocx)(size_t, int) = nullptr; size_t (*nallocx)(size_t, int) = nullptr;
int (*mallctl)(const char*, void*, size_t*, void*, size_t) = nullptr; int (*mallctl)(const char*, void*, size_t*, void*, size_t) = nullptr;
int (*mallctlnametomib)(const char*, size_t*, size_t*) = nullptr; int (*mallctlnametomib)(const char*, size_t*, size_t*) = nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment