Hi,
In the following thread, an hazelcast memory leak is mentioned:
Which has been fixed in the trunk already.
However, I still found another related memory leak using the “JoinTest” below. This memory leak is was also introduced in version 1.9.6.X
After an extensive search and elimination, I found that the following class is causing this memory leak:
http://hazelcast.googlecode.com/svn/trunk/hazelcast/src/main/java/com/hazelcast/impl/ThreadContext.java , Repo version: 2417
Solution: Use this version of ThreadContext.java instead:
One small change is needed in order to compile the code:
84c84
< public Transaction getTransaction() {
---
> public TransactionImpl getTransaction() {
Note: jvisualvm is quite handy to visualize and analyze the heap usage for this problem.
Can this solution be committed into the hazelcast repo?
Thanks!
Eddy van Oosterbosch
import java.util.logging.Logger;
import com.hazelcast.config.Config;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
public class JoinTest
{
private static final int COUNT = 1000; // number of times to try
private static final int SIZE = 2; // size of the cluster
public static void main(String[] args) throws Exception
{
final Logger logger = Logger.getLogger("JoinTest");
final HazelcastInstance[] instances = new HazelcastInstance[SIZE];
for (int i = 0; (i < COUNT); ++i)
{
logger.info("Attempt " + (i + 1));
final Config config = new Config();
config.getGroupConfig().setName("uniqueName:" + i);
// create cluster
for (int j = 0; (j < instances.length); ++j)
{
instances[j] = Hazelcast.newHazelcastInstance(new Config());
}
// verify cluster
for (int j = 0; (j < instances.length); ++j)
{
final int size = instances[j].getCluster().getMembers().size();
if (size != SIZE)
{
logger.severe("OOPS, the cluster size of instance " + j + " was " + size);
System.exit(0);
}
}
// shutdown cluster
for (int j = 0; (j < instances.length); ++j)
{
instances[j].getLifecycleService().shutdown();
instances[j] = null; // just for good measures
}
}
}
}
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/y7vYxyzHILwJ.
Hi Fuad,
I've done some more testing on the "TestMemLeak" test, and found the
following cause:
FactoryImpl
\_ LifeCycleServiceImpl lifeCycleService
\_ :
Node node
\_ SimpleBoundedQueue serviceThreadPacketQueue
The "serviceThreadPacketQueue" is the main occupier of the heap space
(which are visible as byte[]).
I was not able to simple cleanup these queues, maybe you have some
suggestions?
This test uses the one main thread as well.
I will check if we can use your proposed workaround (of using separate
thread).
Never the less, we are interested in the 2.0 release. Do you have an
idea when this could be available?