In our application we often need to do ad-hoc snapshot data queries. For that we create OmmConsumerConfig, read dictionary file (from local filesystem), pass config to w newly created OmmConsumer, then use consumer to subscribe for data, collect it, then unregister the handler. Finally we uninitialize() the consumer and then all references to it (and to config) are cleared (they are both local variables in the method).
This method is called several times a day and we noticed problem with memory usage of our application. We observed it with VisualVM and it was clear to us, that our method was causing it.
Weird thing was that string values from the Dictionary file were appearing there in VisualVM as many times as the method was called, which lead us to thinking some references were not cleared and GC not happend for the whole Consumer/Config structure.
We implemented a pool of consumers now and since then the memory usage is no longer increasing per method call (which indicates problem within the OmmConsumer/OmmConsumerConfig and not in our code which uses it).
Has anyone tried creating many consumers and deleting them during a single app lifecycle? (with loading of dictionary file from local filesystem - this may play a role, or not - I don't know).
Is there anything we need to do apart from calling uninitialize() on the consumer and clearing references to consumer and the config?