Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Hazelcast can consume large amounts of memory in com.hazelcast.nio.Packet instances. #312
I have a situation where clients connect to the cluster and they can get large amounts of data part of the initialization procedure. Clients do not connect all at the same time. Once they got initialized, it is possible that nothing will happen for a while. However, there are some residual com.hazelcast.nio.Packet instance objects held in a queue for reuse in com.hazelcast.nio.Connection objects.
So the end result is that I can get many clients connecting to the cluster over a period of time, without putting any stress on the system. But the Connection instance for each client ends up holding string references to these Packet instances which just use memory which will actually never be used again.
Packet objects are reset immediately after they are retrieved from the pool for reuse.
The problem would go away if Packet objects would be reset just before they are returned to the pool. Reseting a packet is not a significant operation, it boils down to settings some fields to some values, I think is very CPU-cache so it would execute very fast.