Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8526 closed Bugs (fixed)

coroutine memory leak

Reported by: Seunghyun Nam <seunghyun.nam.gg@…> 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 olli, 9 years ago

Resolution: invalid
Status: newclosed

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.

comment:2 by olli, 9 years ago

Resolution: invalid
Status: closedreopened

comment:3 by olli, 9 years ago

Resolution: fixed
Status: reopenedclosed

comment:4 by rivercheng@…, 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.

in reply to:  4 comment:5 by olli, 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.

Note: See TracTickets for help on using tickets.