|
Re: memory leak in udp roundtrip example?: msg#00031lib.boost.asio.user
--- Christopher Kohlhoff <chris-34HiQXrhQN1Wk0Htik3J/w@xxxxxxxxxxxxxxxx> escribió: > Hi Charlls, Hi Chris :) > I was able to reproduce the problem you described, > but the cause is > actually a small error in your program. The program > starts new > async_receive_from operations in both > handle_receive_from and > handle_send_to. > > If you start multiple reads on a socket, they are > added to an internal > queue and complete in order as data arrives. In the > program the length > of this queue is increased by one for every packet > that gets echoed. > > I think all you need to do to fix the leak is to > remove the > async_receive_from call from handle_send_to. ahh this was something that i wasn't clear about; what happened when several async_receive_from calls stacked; if they detected that for this port there was already a receive in place, or they just got queued and put in listening inmediately as the previous returns to handle_receive_from, i know better now >The data passed to async_send_to must be valid for the lifetime of the >operation (i.e. until the handler is called), but the string argument ">str" in this function: hmm, indeed, now i remember when the documentation says in various places that the "async calls are called only from the threads that run io_service::run", now i realize why the insistence :) thank you Chris, as always you have been incredibly helpful. Hope you are well Charlls __________________________________________________ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: retrieving local ip address: 00031, Jeff Koftinoff |
|---|---|
| Next by Date: | Testing socket for disconnect: 00031, Stas Khirman |
| Previous by Thread: | Re: memory leak in udp roundtrip example?i: 00031, Christopher Kohlhoff |
| Next by Thread: | Testing socket for disconnect: 00031, Stas Khirman |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |