To solve OutOfMemoryException, you could edit this file:
Found lines with definition of variable JAVA_OPTS and correct memory limits on what you want. For example I have set 700 mb, and it looks this way:
if [ -z "$JAVA_OPTS" ]; then
JAVA_OPTS="-Djava.awt.headless=true -Xms700m -Xmx700m"
At the end, to make the change on real, restart server with this command:
sudo service tomcat7 restart