[xwiki-users] [Error]: Java heap memory error on adding large attachment

[Ricardo Rodriguez] Your EPEC Network ICT Team webmaster at environmentalchange.net
Sat Feb 16 23:09:28 CET 2008


Pavel wrote:
> Here is my version of what happens in Q&A.
>
> * What does out of memory error mean?
>   - Java virtual machine (which runs tomcat which runs xwiki) has run 
> out of heap space and cannot allocate anything anymore.
>
> * Is it related to MySQL packet size?
>   - No
>
> * Why this error happens?
>   - Because application needs more memory than JMV is allowed to use.
>
> * How is that related to attachments?
>   - The way xwiki handles attachments is, well, not perfect.
>   Somewhat related thread is 
> http://lists.xwiki.org/pipermail/users/2007-November/009362.html
>
> * So what can you do?
>   - a) Use -Xms and -Xmx java parameters to increase heap size.
>   - b) Implement and contribute to XWiki effective attachment handling.
>
> * What are the -Xms and -Xmx params?
>   - -Xms tells java the initial heap size, -Xmx controls max size. The 
> latter is of special interest in this case and can be increased.
>
> Pavel

Hi Pavel,

Do you know if this heap size issue happens just working with Tomcat as 
servlet container or it is generalizable to other application servers? 
It could be advisable clarify that this FAQ applies just to XWiki 
running on a Tomcat/MySQL server.

I would add a link to "heap", something as 
http://dictionary.zdnet.com/definition/heap.html. I am not a programmer, 
so I do need this kind of help to know what is happening with my 
installation :-)

As per the CATALINA_OPTS or JAVA_OPTS variables, it would be great to 
have a confirmation, but by tracking their values along catalina.sh and 
startup.sh I reach the same conclusion you presented. FAQs are wiki 
entries, so anybody can modify them! I would add some
sample lines as (this apply to Unix-based systems, could you add that 
applying to Windows ones?)...

* to be included in a script calling startup.sh: both variables will be 
passed in to the startup process.

export CATALINA_OPTS="-Xmx512m -Xms512m"
export JAVA_OPTS="-Xmx512m -Xms512m"

I am guessing it is of course possible to add this values within 
catanina.sh or startup.sh, but I do prefer don't touch these files if 
possible.

Cheers,

Ricardo


-- 
Ricardo Rodríguez
Your EPEC Network ICT Team



More information about the users mailing list