GeeCON Prague 2014*
The moose likes Struts and the fly likes Why does my actionclass accumulate memory? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Why does my actionclass accumulate memory?" Watch "Why does my actionclass accumulate memory?" New topic
Author

Why does my actionclass accumulate memory?

Mattias Andersson
Greenhorn

Joined: Nov 17, 2010
Posts: 20
I have an actionclass which is called by ajax on the web page.
I create only an object of Testclass.
Looking in a memory profiler I can see that for each ajax request there is a new Testclass on the heap.
Even if thisClass in nulled it is still there on the heap.
And next time this action executes there are 2 Testclass on the heap etc...





Is there anyone who can tell me whats wrong?
I have been struggling with this problem a few days now and are starting to get desperate.


It's better to be approximately right than exactly wrong.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8914
    
    8

Garbage collection is not instantaneous. If you have a large heap, you may accumulate many instances before they are swept up.
Your profiler may have a way to trigger garbage collection. Try that and see what happens.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
GeeCON Prague 2014
 
subject: Why does my actionclass accumulate memory?