#8526 closed Bugs (fixed)
coroutine memory leak
Reported by: | Owned by: | olli | |
---|---|---|---|
Milestone: | To Be Determined | Component: | coroutine |
Version: | Boost 1.53.0 | Severity: | Problem |
Keywords: | Cc: | seunghyun_nam@… |
Description
hi i'm Seunghyun
I prediect there is a memory leak in coroutine library. following codes make incresing used memory. I found Caller object generated at coroutine_object<>::run() is not deleted. Check please. Sorry for my bad english.
typedef boost::coroutines::coroutine<void()> coro_t;
void f(coro_t::caller_type &caller) { }
void invoke() {
while(true) {
coro_t co(&f);
}
}
Change History (5)
comment:1 by , 9 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 9 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
follow-up: 5 comment:4 by , 9 years ago
Hi, Oliver Could you please explain how this bug is fixed? It exists in 1.53 release and I want to know whether I can make a small change to existing codes to fix this problem instead of waiting for another release. Thanks a lot.
comment:5 by , 9 years ago
Replying to rivercheng@…:
Hi, Oliver Could you please explain how this bug is fixed? It exists in 1.53 release and I want to know whether I can make a small change to existing codes to fix this problem instead of waiting for another release. Thanks a lot.
void run() {
... {
Caller c( this->caller_, false, this->preserve_fpu(), alloc_); fn_( c); ...
} ...
}
If coroutine is unwinded fn_() throw unwind-excpetion and Caller ist automatically destructed.
the caller is allocated on the stack of the calling coroutine - the destructor will not be called but the stack (memory) is released or reused after the calling coroutine is destroyed - so it is not a memory leak.