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

  • Suspicous memory leak ?

    In a project using spring & hibernate, I've used an Interceptor class implementing the ApplicationContextAware interface so that bean dependencies are set by spring during initialization(just as i've read on various posts here & there).
    However between my junit tests (integration tests) the ApplicationContext & Interceptor wont be collected by GC & after a while I get stuck with an OutOfMemroyError. But when the ApplicationContextAware implementation is removed from the class, it work's fine.
    The interceptor bean is only referenced by the SessionFactory and again removing the reference will solve the problem.

    Has anybody a clue where i'm doing wrong ?

  • #2
    Hmm, I think you're going to have to describe the setup a bit better. Just making a bean ApplicationContextAware should not affect whether it's garbage collected or not. The bean is going to have a reference to the appcontext (assuming it keeps it), but that does not change whether the appcontext holds a reference to it. If the bean is a singleton, the appcontext will hold a reference to it in either case. And if it's a prototype, it won't.

    So my feeling is that things are not quite as you describe them here (or what it sounds like, anyway)...