1 Reply Latest reply on Jun 13, 2008 4:21 PM by Norman Richards

    Stateful Session Bean memory leak

    Laurence Kirk Newbie

      We have found that if a SFSB contains a reference to another SFSB (using @EJB or @In) , that the contained SFSB is never garbage collected, whereas the containing SFSB is removed and collected as expected.





      So in the example below testComponent is never garbage collected, but testHolder is removed and garbage collected as normal.
      This is using Seam 2.0.2.CR1 and JBoss 4.2.2.GA


      Name("testHolder")
      
      @Scope(ScopeType.CONVERSATION)
      
      @Stateful
      
      @AutoCreate
      
      public class TestHolder  implements TestHolderManager,Serializable {
      
      
              
      
       @EJB TestComponentManager testComponent;
      
      ....
      
      }
      
      
       and 
      
      
      @Name("testComponent")
      
      @Scope(ScopeType.CONVERSATION)
      
      @Stateful
      
      @AutoCreate
      
      public class TestComponent  implements TestComponentManager, Serializable{
      
      
      ...
      
      }
      
      




      As a work around we have an interceptor that ensures that all contained SFSBs have a remove method called when their holding SFSB is removed.


      Has anyone else experienced this ?