Skip to content

Commit

Permalink
Add missing custom-allocation routine for InlineTaskDetached
Browse files Browse the repository at this point in the history
Summary:
Allocation of InlineTaskDetached coroutines now call through to the
folly_coro_async_malloc() and folly_coro_async_free() functions so that
their allocations can be correctly accounted for as coroutine allocations.

Reviewed By: yfeldblum

Differential Revision: D24574568

fbshipit-source-id: 9bece3f8e6f6d221bca021a50fe02e1eed88f07b
  • Loading branch information
Lewis Baker authored and facebook-github-bot committed Oct 28, 2020
1 parent e90879c commit 063ef0c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions folly/experimental/coro/detail/InlineTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ inline InlineTask<void> InlineTaskPromise<void>::get_return_object() noexcept {
struct InlineTaskDetached {
class promise_type {
public:
static void* operator new(std::size_t size) {
return ::folly_coro_async_malloc(size);
}

static void operator delete(void* ptr, std::size_t size) {
::folly_coro_async_free(ptr, size);
}

InlineTaskDetached get_return_object() noexcept { return {}; }

std::experimental::suspend_never initial_suspend() noexcept { return {}; }
Expand Down

0 comments on commit 063ef0c

Please sign in to comment.