Search code examples
spring-integrationsplitter

Spring integration splitter aggregator memory leak


I have created the following project:

https://github.com/adispennette/splitter-aggregator-leak-example

to test a memory leak I am seeing in another application. I am using eclipse to run the junit and monitoring the memory using jconsole. once the test starts I connect to the JUnit runner and do a manual GC. from that point I let it run and the memory just continues to increase. The theory here is that the aggregator is not releasing properly.

I have attempted to get this to release the collections in every way I can think of but it keeps growing.

is there something I am missing?


Solution

  • In order to discard late-arriving messages, the aggregator has to retain metadata for released groups. Set expire-groups-upon-completion="true" to remove this metadata when the group is released. However, late arriving messages will now form a new group.

    If you want the default behavior but are concerned about the small amount of memory required for the metadata, you can configure a MessageGroupStoreReaper as described in the documentation. Empty groups can be expired on a different schedule to partial groups.