1

We create a simple iqueue in Hazelcast:

    HazelcastInstance h = Hazelcast.newHazelcastInstance(config);
    BlockingQueue<String> queue = h.getQueue("my-distributed-queue");

Let's assume that queue.size() == 0.

Does the distributed queue "my-distributed-queue" use any memory resources?

Background:

I want to use Hazelcast for creating large amount (>1k) of short lived queues (for keeping time order in item groups). I'm wondering what happens if an IQueue object in Hazelcast is drained out (size==0). Will it leave any artifacts in memory that won't be cleaned up by GC?

I've analized the heap dumps in VisualVM and I've found that queue items are stored as IQueueItem objects. When the queue size is 0, then there are no IQueueItem instances. But are there any other no removable artefacts? Thx for help.

1 Answer 1

1

There is some fixed cost of each structure even if it doesn't contain any data. The cost is rather low, you can see the structure backing each instance of a queue here: https://github.com/hazelcast/hazelcast/blob/master/hazelcast/src/main/java/com/hazelcast/queue/impl/QueueContainer.java

You can always destroy a queue once you don't need it - just call the destroy() method Each structure provided by Hazelcast implements this interface.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.