Commit 8bc1252f authored by Dan Melnic's avatar Dan Melnic Committed by Facebook Github Bot

Add folly::sizedFree

Summary:
Add folly::sizedFree

(Note: this ignores all push blocking failures!)

Reviewed By: ot

Differential Revision: D19944311

fbshipit-source-id: b5b1a648a180662fe838237c3c3b153e42fe0617
parent cae89fc3
...@@ -180,6 +180,14 @@ inline void* checkedRealloc(void* ptr, size_t size) { ...@@ -180,6 +180,14 @@ inline void* checkedRealloc(void* ptr, size_t size) {
return p; return p;
} }
inline void sizedFree(void* ptr, size_t size) {
if (usingJEMalloc()) {
sdallocx(ptr, size, 0);
} else {
free(ptr);
}
}
/** /**
* This function tries to reallocate a buffer of which only the first * This function tries to reallocate a buffer of which only the first
* currentSize bytes are used. The problem with using realloc is that * currentSize bytes are used. The problem with using realloc is that
......
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