Announcement Announcement Module
No announcement yet.
ThreadLocalTargetSource memory issues Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ThreadLocalTargetSource memory issues

    We are using a ThreadLocalTargetSource to inject a User bean into services that need access to it in our application. We have noticed that these User objects seem to hang around and not get cleaned up. In looking at the source code, we have a theory as to why this is. In ThreadLocalTargetSource, there is a property called targetSet that each target (User in our case) gets added to. It appears this set is only cleared by the destroy method when the BeanFactory goes away. In our case, being a Hibernate app, BeanFactory is expensive to create so we create one and get to using the SingletonBeanFactoryLocator to keep hold of it. So it appears that our User objects will just accumulate in the set for the life of our app, which is precisely what the HeapDumps seem to tell us as well. My question is: what can I do to get rid of this targetSet? What would be the downside, other than losing stats, of writing a version of ThreadLocalTargetSource, that didn't do this? Anyone have any better ideas?

  • #2
    It seems odd that you have such a large number of thread-bound target misses that targets are accumulating. What is your environment and what is your requirement for the ThreadLocalTargetSource?