outOfMemoryError

isagol isagol1604 at gmail.com
Wed Jan 5 03:17:28 EST 2011


Hi everyone. First of all . i should thanks everyone.
Netty is very powerfull and this user group very helpfull to solve problems.
:) 

my problem about java memeory heap. when i run project. i got a result like
this.

Exception in thread "pool-2-thread-1" java.lang.OutOfMemoryError: Java heap
space
	at java.util.regex.Matcher.<init>(Unknown Source)
	at java.util.regex.Pattern.matcher(Unknown Source)
	at
org.jboss.netty.util.internal.StackTraceSimplifier.simplify(StackTraceSimplifier.java:80)
	at
org.jboss.netty.logging.InternalLoggerFactory$1.warn(InternalLoggerFactory.java:132)
	at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:236)
	at
org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
	at
org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

there is one client and one server. Client sends an integer to server
continuesly. and Server recieves these messages and append a dynamic
ChannelBuffer. Ofcourse there is a limit of heap. But i think its not about
the heap size. i am printing the buffer size when messages recieved and its
changable. Not a constant value. 

i am sending messages in client messageRecieved method. 
@Override
	public void messageReceived(ChannelHandlerContext ctx, final MessageEvent
e) {

		ChannelBuffer buf = buffer(4);
		buf.writeInt(123412341);
		while (true) {
			
			e.getChannel().write(buf);
			
		}

	}

in server side. i am recieving messages 

        static public ChannelBuffer dataBuffer;
	private ChannelBuffer buf;

	
	public ServerHandler() {
		dataBuffer = ChannelBuffers.dynamicBuffer();
	}

        @Override
	public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {

		Channel channel = e.getChannel();

		buf = (ChannelBuffer) e.getMessage();
		dataBuffer.writeBytes(buf.toByteBuffer());
		buf.clear();
		System.out.println("size: " + dataBuffer.toByteBuffer().limit());

	}

Thanks in Advance...
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/outOfMemoryError-tp5891305p5891305.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list