'Memory leak issue in apache camel with openzipkin brave

I am using apache camel Routes in a spring boot project that has openzipkin brave configured.

I noticed that the memory of the application gets grows under load, but the memory never gets reclaimed after the loaded finishes.

I got a memory dump, then I found that (unsurprisedly) java.lang.Thread is the most memory-consuming object, but when I dig more, I found that a lot of objects created and stored in each Thread of types brave.propagation.ThreadLocalSpan$SpanAndScope

enter image description here

BTW, in the camel route, I am setting threads(50, 100)

What I am seeking is proper explanation and support on my finding, which says that brave.propagation.ThreadLocalSpan$SpanAndScope might be the root cause!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source