Discussions

EJB programming & troubleshooting: Stateful Session Bean Memory

  1. Stateful Session Bean Memory (2 messages)

    Hello,

    I'm using a Stateful Session bean to query a database. The data retrieved will be set into a class instance and this instance is added to a vector. When all the data has been retrieved, the vector is returned to the client. After the vector is return I call the remove() method. However, the amout of memory used when the bean is ivoked does not seem to reduce in any capacity. I have noticed that the amount of memory does increase whrn the bean is invoked using the create() method.

    I was wondering if anyone could give me some advice on why this would be hapenning and if it is normal?

    thanks in advance

    suraj.
  2. Stateful Session Bean Memory[ Go to top ]

    Suraj,

    Does this problem ultimately cause your server to crash because of low memory? If it does, then you do have a problem, and I can't guess what it is without the related source code. However, you should remember that Java uses a garbage collector to release memory. If the VM is not running very low on memory, the garbage collector may not run for quite some time. This can create the illusion of a memory run, but is actually quite harmless.
    My advise to you is, run many requests to the session bean, and see whether or not the server eventually crashes or becomes unreasonably slow. If it doesn't, chances are you're OK.

    Gal
  3. Stateful Session Bean Memory[ Go to top ]

    Thank you. I have not had the chance to load test my beans as of yet. Once again thanks for the advise.