Memory Issue

J

Jason.Herald

I am having an issue where a struts based application continually
uses more and more ram. I get the available memory on each pass and
manually call gc which has slowed the issue but not fixed it.

I.e:
public ActionForward view (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {

Session ses = new SessionManager().getSession();

Rooms rooms = new Rooms(ses);
Posts posts = new Posts(ses);

HttpSession session = request.getSession();

List room_list = rooms.find_all();
request.setAttribute("rooms", room_list);


List post_list = posts.full_set(new
Long(session.getAttribute("room_id").toString()));
request.setAttribute("posts", post_list);

rooms = null;
posts = null;

/* runtime variable r is declared above */
r.gc();

return mapping.findForward("done");

}


The memory usage follows this pattern:

Pass 1: (before gc) 231.4797 (after gc) 242.2315
Pass 2: (before gc) 232.2050 (after gc) 241.6035
Pass 3: (before gc) 231.8197 (after gc) 241.2478

JVM is started using (although I have tried many different
combinations of the arguments):

-server -XX:+CMSClassUnloadingEnabled -XX:permSize=128M -
XX:MaxPermSize=128M -Xconcurrentio -XX:+UseConcMarkSweepGC -
XX:NewRatio=30 -XX:+UseParNewGC -XX:NewSize=8m -XX:MaxNewSize=8m -
Xms256m -Xmx256m -XX:MinHeapFreeRatio=70 -XX:MaxHeapFreeRatio=90

Any ideas would be greatly appreciated and if you want to see any of
the other files let me know.

Thanks in advance!

Jason
 
N

none

I am having an issue where a struts based application continually
uses more and more ram. I get the available memory on each pass and
manually call gc which has slowed the issue but not fixed it.

I.e:
public ActionForward view (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {

Session ses = new SessionManager().getSession();

Rooms rooms = new Rooms(ses);
Posts posts = new Posts(ses);

HttpSession session = request.getSession();

List room_list = rooms.find_all();
request.setAttribute("rooms", room_list);


List post_list = posts.full_set(new
Long(session.getAttribute("room_id").toString()));
request.setAttribute("posts", post_list);

rooms = null;
posts = null;

/* runtime variable r is declared above */
r.gc();

return mapping.findForward("done");

}


The memory usage follows this pattern:

Pass 1: (before gc) 231.4797 (after gc) 242.2315
Pass 2: (before gc) 232.2050 (after gc) 241.6035
Pass 3: (before gc) 231.8197 (after gc) 241.2478

JVM is started using (although I have tried many different
combinations of the arguments):

-server -XX:+CMSClassUnloadingEnabled -XX:permSize=128M -
XX:MaxPermSize=128M -Xconcurrentio -XX:+UseConcMarkSweepGC -
XX:NewRatio=30 -XX:+UseParNewGC -XX:NewSize=8m -XX:MaxNewSize=8m -
Xms256m -Xmx256m -XX:MinHeapFreeRatio=70 -XX:MaxHeapFreeRatio=90

Any ideas would be greatly appreciated and if you want to see any of
the other files let me know.

Thanks in advance!

Jason

it's hard to say without the list of imports and without the code of the
beans Room and Post.
by the way the before gc value deos not seem to grow...
 
D

Daniel Pitts

I am having an issue where a struts based application continually
uses more and more ram. I get the available memory on each pass and
manually call gc which has slowed the issue but not fixed it.
[snip code]
Any ideas would be greatly appreciated and if you want to see any of
the other files let me know.

Thanks in advance!

Jason
Unless you are seeing an Out Of Memory exception, don't worry about
available memory. The Garbage Collector doesn't necessarily pick things
up as soon as they're no longer needed.

You might also make sure that you're not holding on to objects in static
maps/collections or long lived maps/collections.
 
L

Lew

Daniel said:
I am having an issue where a struts based application continually
uses more and more ram. I get the available memory on each pass and
manually call gc which has slowed the issue but not fixed it.
[snip code]
Any ideas would be greatly appreciated and if you want to see any of
the other files let me know.

Thanks in advance!

Jason
Unless you are seeing an Out Of Memory exception, don't worry about
available memory. The Garbage Collector doesn't necessarily pick things
up as soon as they're no longer needed.

You might also make sure that you're not holding on to objects in static
maps/collections or long lived maps/collections.

For those who answered on clj.programmer, there is more in response to the
clj.help multipost, and vice versa.

To the OP: Please do not multi-post. Read the FAQ post from David Alex Lamb,
"comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2006-03-31)",
and its links for details. The FAQ is posted every five days, so there are no
worries about missing it.

Cross-posted in service of the OP.
 
J

Jason.Herald

it's hard to say without the list of imports and without the code of the
beans Room and Post.
by the way the before gc value deos not seem to grow...- Hide quoted text -

- Show quoted text -

It does shrink over time.
Before my original changes it took about 3 minutes to get to an out of
memory exception.
 
J

Jason.Herald

it's hard to say without the list of imports and without the code of the
beans Room and Post.
by the way the before gc value deos not seem to grow...- Hide quoted text -

- Show quoted text

The imports are the standard ones for a servlet.
I will post the code in the morning for you to review.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top