Skip to content

Copy constructor gets called for return value of continuation of folly Future #654

@sanjosh

Description

@sanjosh

See attached file
copy_move.txt

Any idea how I can prevent a copy of the return type which is being made when the continuation of a Future executes ? I looked at the tests in folly/futures/test but couldn't find anything relevant

this is the stack when the copy constructor is called
` where

#0 MyData::MyData (this=0x7fffffffce60, other=...) at copy_move.cpp:14

#1 0x000000000040b5c1 in <lambda(int)>::operator()(int) const (__closure=0x6030000008e0) at copy_move.cpp:32

#2 0x000000000040bba5 in folly::detail::CoreCallbackState<MyData, func()::<lambda(int)> >::invoke(<unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x25b4e>) (this=0x6030000008e0,
args#0=<unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x25b4e>)
at /usr/local/include/folly/futures/Future-inl.h:85

#3 0x000000000040bc8a in folly::Future::<lambda(folly::Try&&)>::<lambda()>::operator()(void) const (
__closure=0x7fffffffd000) at /usr/local/include/folly/futures/Future-inl.h:243

#4 0x000000000040cbd7 in folly::makeTryWith<folly::Future::thenImplementation(F&&, folly::detail::argResult<isTry, F, Args ...>)::<lambda(folly::Try&&)> mutable [with F = func()::<lambda(int)>; R = folly::detail::callableResult<int, func()::<lambda(int)> >; bool isTry = false; Args = {int&&}; T = int]::<lambda()> >(<unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x2503a>) (f=<unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x2503a>)
at /usr/local/include/folly/Try-inl.h:151

#5 0x000000000040be83 in folly::Future::<lambda(folly::Try&&)>::operator()(<unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x21ad0>) (__closure=0x6030000008e0,
t=<unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x21ad0>)
at /usr/local/include/folly/futures/Future-inl.h:242

#6 0x000000000040db1a in folly::detail::function::FunctionTraits<void(folly::Try&&)>::callBig<folly::Future::thenImplementation(F&&, folly::detail::argResult<isTry, F, Args ...>) [with F = func()::<lambda(int)>; R = folly::detail::callableResult<int, func()::<lambda(int)> >; bool isTry = false; Args = {int&&}; T = int]::<lambda(folly::Try&&)> >(folly::detail::function::Data &, <unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x20912>) (
p=..., args#0=<unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x20912>)
at /usr/local/include/folly/Function.h:305

#7 0x0000000000418033 in folly::detail::function::FunctionTraits<void (folly::Try&&)>::operator()(folly::Try&&) (this=0x610000000040, args#0=<unknown type in /home/sandeep/a.out, CU 0xdf8, DIE 0x21636>)
at /usr/local/include/folly/Function.h:314

#8 0x0000000000415f17 in folly::detail::Core::doCallback (this=0x610000000040)
at /usr/local/include/folly/futures/detail/Core.h:388

#9 0x0000000000414208 in folly::detail::Core::maybeCallback()::{lambda()#2}::operator()() const (
__closure=0x7fffffffd7c0) at /usr/local/include/folly/futures/detail/Core.h:317

#10 0x000000000041644f in folly::detail::FSMfolly::detail::State::updateState<folly::detail::Core::maybeCallback()::{lambda()#1}, folly::detail::Core::maybeCallback()::{lambda()#2}>(folly::detail::State, folly::detail::State, folly::detail::Core::maybeCallback()::{lambda()#1} const&, folly::detail::Core::maybeCallback()::{lambda()#2} const&) (this=0x6100000000a8, A=folly::detail::State::Armed, B=folly::detail::State::Done, `

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions