I do have a great increase, the module HTML is my test by the way, it allocates way to 
much memory for a form.

I used jprofiler to track the memory and realized that the Apache library was using 
many times big amount of memory, looking into the source code i saw that for each 
field of the form (any id or textform or file ...) it was allocating the size of the 
threshold !

(the threshold indicates from what size should the library store the fields in a file 
or in memory)

Our threshold is pretty high as we don't want the files to be written on the disk, so 
it was allocating way to much memory. For example when i was submitting a 50KB file 
into the HTML module, i got about 55MB increase in memory it's enough to make my 
computer swap a lot.
After the quick fix i still have a 20MB increase (much better, still a lot though).

If you have many fields in your form (and i repeat ANY field) the memory allocated 
will be way too much.

After the fixing i looked some more and found a guy complaining about the same thing 
and proposing a patch but Apache guys didn't want to use it...

I forgot to tell precisely the source change here it is:
In DeferredFileOutputStream there is this method:
   public DeferredFileOutputStream(int threshold, File outputFile)
    {
        super(threshold);
        this.outputFile = outputFile;

        memoryOutputStream = new ByteArrayOutputStream(threshold);
        currentOutputStream = memoryOutputStream;
    }

That's where it allocates 'threshold' bytes whatever the size of the field, i just 
removed threshold so Java just gives 32Bytes and allocate more only if needed.




View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3843962#3843962

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3843962


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to