On Fri, Mar 6, 2015 at 2:37 AM, 贾凯 <[email protected]> wrote: > The problem of libuv is that it does not call the completion callback right > after write succeeds. Instead, it is only until all I/Os are performed that > the callbacks are called. This means that if you have 1,000 connections > sending 64KB of data, your code first allocates 64KB of memory 1000 times > (64MB in total) and then call freefor all of those memory chunks, even when > the network operation does not block. IMO, libuv should better call the > completion callback immediately after the application returns the control > back to the library after calling uv_write, so that the memory allocation > pattern could be a repetition of malloc-and-then-free for 1000 times. > (from > http://blog.kazuhooku.com/2014/09/the-reasons-why-i-stopped-using-libuv.html)
If your libuv is new enough, you can use uv_try_write() instead of uv_write(). -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
