[
https://jira.jboss.org/jira/browse/JGRP-1180?page=com.atlassian.jira.plug...
]
Bela Ban commented on JGRP-1180:
--------------------------------
OK, the problem is in your code: you don't set a receiver, so all mesage accumulate in
the receiver's queue. See the changed program below for the correct way:
package org.jgroups.tests;
import org.jgroups.Message;
import org.jgroups.JChannel;
import org.jgroups.ReceiverAdapter;
public class testbed {
public static void main(String[] args) throws Exception
{
JChannel channel = new JChannel(args[0]);
channel.connect("channelName");
channel.setReceiver(new ReceiverAdapter() {
int count=0;
public void receive(Message msg) {
count++;
if (count % 100000 == 0)
System.out.print("\r" + count);
}
});
for (int i = 0; i < 100000000; i++)
{
Message msg = new Message(
null,
null,
"Test");
channel.send(msg);
// Thread.sleep(10);
}
}
}
OutOfMemoryError
----------------
Key: JGRP-1180
URL:
https://jira.jboss.org/jira/browse/JGRP-1180
Project: JGroups
Issue Type: Bug
Affects Versions: 2.8
Environment: 2.8.0.GA
Reporter: Peter Kormos
Assignee: Bela Ban
Hi Guys,
I wrote a simple program.
public testbed() throws Exception
{
JChannel channel = new JChannel();
channel.connect("channelName");
for (int i = 0; i < 100000000; i++)
{
Message msg = new Message(
null,
null,
"Test");
channel.send(msg);
// Thread.sleep(10);
if (i % 1000 == 0)
System.out.print(".");
}
}
When I run it with
java -Xmx8m -XX:+HeapDumpOnOutOfMemoryError -cp .;jgroups-all.jar testbed
not always, but quite often it dies with OutOfMemoryError
When I look at the heap dump with jhat, for "Instance Counts" it tells me
22036 instances of class org.jgroups.Message
22036 instances of class org.jgroups.protocols.pbcast.NakAckHeader
22036 instances of class org.jgroups.util.Headers
21316 instances of class org.jgroups.Event
21314 instances of class org.jgroups.util.Queue$Element
304 instances of class org.jgroups.util.UUID
Why are there so many message objects stuck in memory?
java org.jgroups.Version prints
Version: 2.8.0.GA
CVS: $Id: Version.java,v 1.81 2009/12/01 10:31:13 belaban Exp $
I'm using Windows Xp with 1.6 JDK
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira