Commit 93b54d70 authored by Dan Melnic's avatar Dan Melnic Committed by Facebook GitHub Bot

Add support for IOBuf::takeOwnership sizedFree

Summary:
Add support for IOBuf::takeOwnership sizedFree

(Note: this ignores all push blocking failures!)

Reviewed By: simpkins

Differential Revision: D28510736

fbshipit-source-id: b102bd462df3d85856897d4acfff689d371ceb6c
parent f2e8440c
......@@ -377,6 +377,11 @@ IOBuf::IOBuf(
// since we use that for folly::sizedFree
DCHECK(!userData || (userData && freeFn));
// add support for sized dealloc if freeFn is null
if (!userData && !freeFn) {
userData = reinterpret_cast<void*>(capacity);
}
auto rollback = makeGuard([&] { //
takeOwnershipError(freeOnError, buf, freeFn, userData);
});
......@@ -396,6 +401,11 @@ unique_ptr<IOBuf> IOBuf::takeOwnership(
// since we use that for folly::sizedFree
DCHECK(!userData || (userData && freeFn));
// add support for sized dealloc if freeFn is null
if (!userData && !freeFn) {
userData = reinterpret_cast<void*>(capacity);
}
HeapFullStorage* storage = nullptr;
auto rollback = makeGuard([&] {
if (storage) {
......
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