File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Form submission using huge amounts of memory! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Form submission using huge amounts of memory!" Watch "Form submission using huge amounts of memory!" New topic
Author

Form submission using huge amounts of memory!

Jamie Williams
Ranch Hand

Joined: Mar 31, 2006
Posts: 70
I have an application with a dynamically generated form with two text input boxes and a checkbox for each row. It works ok when it only has about 30 rows, but I need to be able to have it work with 200+.

When I have alot of rows and I submit the form it uses a HUGE amount of memory and runs out of heap space. Maybe my idea of 'lots of memory' is wrong but I'm talking about a tomcat server for this one app and it's got 768 MB of memory dedicated to it. It's not my code that is supposed to process the submitted stuff though - it doesn't get that far. From my testing I found when this problem happens it's before it even gets to the action method, so I'm thinking it must be to do with setting the new values to the backing objects. Has anyone else got this problem? Is it common? What can I do to get it to use less memory!?
Jamie Williams
Ranch Hand

Joined: Mar 31, 2006
Posts: 70
PLEASE! Can't anyone help me? I've tried allocating 2 GIGABYTES of memory to Tomcat now and it still runs out of memory when I try to submit the form!
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I've never run into this problem before. However, I doubt I have ever tried submitting a form as large as the one you are trying to submit.

A) Maybe not very helpful, but submitting a form updating 200+ rows of data sounds like a bad design. You might look at a way to trim down the updatable amounts.

B) Form submissions using component oriented frameworks will typically use more memory than their lighter cousins like Struts. JSF saves a component tree in memory of every page you submit and image that with 200+ rows of data being submitted. Yikes! Brings me back to point A.


GenRocket - Experts at Building Test Data
Jamie Williams
Ranch Hand

Joined: Mar 31, 2006
Posts: 70
Thanks for the reply!

Well, working with a form that big is not my idea of a good interface design, but try telling my boss that! That's the sort of system he likes to work with
I partly solved the problem yesterday when I took out the converters and validators on some hidden fields that I'm using to store default values in for my javascript to work with. To work with that I had to make up a bogus set to getters and setters that work with Strings and just didn't do anything when the setters were called - terrible design but it's working for now. It still uses alot of memory though!

I would really like to know a way to produce text input fields with values from a bean, but that won't update the bean when the form is submitted and that has the same extention as all of the other components in the row i.e. '_id27' so I can access them from my javascript functions. Basically an h:inputText type component that doesn't update the bean it's mapped to when submitted.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form submission using huge amounts of memory!
 
Similar Threads
OutOfMemory Exception and JTable
Submitting a table in a form
Error 405
Memory Mgt: Giving memory from ArrayList back to VM?
Unclear on what's happening with validation