OutOfMemory in HttpClient

jaimemm jaimemm at gmail.com
Mon Jan 19 07:20:35 EST 2009


Mmmmm it's not a memory leak...it's because I'm running out of OS memory to
create Threads!!
Please have a look to the attached screenshot from the jconsole.

Why does it keep creating threads instead of reusing them? Is there any way
to limit the number of threads?


http://n2.nabble.com/file/n2181002/values.jpg values.jpg 
-----------------------------------



Wesly smith wrote:
> 
> Gee... you asked a very similar question like mine.
> 
> In my case, I set the NIO selector loop number too high, such as 160
> below, and I sent in 1M content size message from client, and it caused
> out-of-message on my setup.
>   ChannelFactory factory = 
>     new NioClientSocketChannelFactory( 
>         Executors.newCachedThreadPool(), 
>         Executors.newCachedThreadPool(), 160); 
> 
> But after I switch the default numbers (usually, the jvm pick up the core
> numbers if you don't specify it), and I didn't see the out-of-memory
> problem after I punched 100000 messages with each client message having
> ChannelBuffer 1024x1024 bytes.
> 
> 
> 
> jaimemm wrote:
>> 
>> Taking the HTTP Client server example and including into a loop, to send
>> N messages, the connection &  send message logic, the memory consumption
>> raises over 500mb for just 700 messages (10Kb each) which causes the
>> OutOfMemoryException. Am I doing something wrong? is there any piece of
>> code susceptible of memory leaking? What should I check?
>> 
>> thanks
>> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/OutOfMemory-in-HttpClient-tp2170142p2181002.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list