-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When attaching a continuation to boost::future, the continuation is executed in a new thread(default), which will cause memory usage problem #156
Comments
I guess i encountered this problem: https://svn.boost.org/trac/boost/ticket/12220 And that's a bug of Boost, which have been fixed. Here is my code ( boost verison 1.59.0 with gcc 4.8.4 and ubuntu 14.04 ): If you don't use
|
First, thanks for giving more context and explaining. I reopened the issue. So this is fixed in Boost 1.62.0 and the memory leak will only hit when using an older version? Because, if this is the case, then we can simply require 1.62.0 or higher rather than changing all our examples with this workaround / hack .. which makes the code look rather ugly. |
Here is more context:
|
Ahhh .. one of the answers in above SO post reveals more: "It is customizable whether boost::future continuation should be executed in a new thread or in the calling thread."
IMO it is highly disturbing and unexpected that this is NOT the default! I don't want random continuations spawn new threads all the time. I don't want threads at all (unless I explicitly need them because I am doing CPU bound stuff). This sucks big time. In fact, this might be related to #146 Not only does Boost spawn threads for each and every continuation, but it then fails to cleanup the mess properly. Oh well, C++ has still a long way to go in the async world. I recently learned that co-routines didn't make it into C++ 2017, and will not come before C++ 2020. This is a joke. Come on .. we have usable co-routines in Python/Twisted for 10+ years now;) |
@fengzhuye so can you confirm that |
This is my blog :), amazing you found it: http://blog.csdn.net/gw569453350game/article/details/62426378 I am not sure whether the boost::future have fixed the memory leak bug(cause i didn't test it). But make the |
Your blog is easy to find, as you linked it on your GitHub user page. Problem is: I cannot read it .. other than code .. ha;) What are you working on / using AutobahnC++ for btw? |
We use WAMP as a tool to connect the ui and embeded robot controller. Besides, we use the bonefish router, which is very good and much faster. Cheers, |
Ah, interesting.
|
@fengzhuye put differently, your proposal of adding Do you know how to do that? |
@oberstet It seems there is no such global option:
|
@fengzhuye I was afraid there isn't a global option .. thanks for confirming!
It seems, we don't have a lot of options, and all of them are not pretty:
|
Asio was updated in Boost 1.66 release. There's mention of executors in this new documentation page: http://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/net_ts.html I'm too busy with work/life right now to investigate any deeper. Coroutines and the traditional callback interface have been working well for us so far at work; we don't use use futures. |
In the example
callee.cpp
: one should not use it thisbut like this:
The text was updated successfully, but these errors were encountered: