Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm new to Geoserver, Ubuntu and Java, but have downloaded a virtual machine from gisvm.com and am getting up to speed. I got as far as configuring it with some fairly large shapefiles from a project I've worked on previously.

My question is related to a problem which I see if I show the shapefile using the OpenLayers layer preview option. I see an error 'OpenLayers map preview code="internalError" Rendering process failed. java.lang.OutOfMemoryError: Java heap space'. Googling has led me to plenty of Java command line options to increase heap space, but I have no idea if this should be applied to an environment variable, in a startup script or as a part of the Geoserver config. Can you help me to understand what I need to edit to get this working? I'm also wondering if I should be splitting my shapefile into smaller pieces and so any guidelines on this matter would be helpful too.

Thanks!

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

You must change memory heap in your JVM. I supposed that gisvm.com use Tomcat, so you can find a lot of tutorials about "increase java heap space in Tomcat" in google. Basically is add -Xmx128m parameter to JVM to increasing memory heap.

share|improve this answer
1  
Ah, ok, I found that /etc/default/tomcat6 contains this line: JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC" - I guess I edit that? Trying -Xmx512m ... –  Elliveny May 31 '11 at 15:22
    
I tried it and it worked! Thanks for the pointer to Tomcat, I hadn't realised that it was involved. –  Elliveny Jun 1 '11 at 9:57
add comment

You can increase Memory Allocation in the following ways

(performance settings in the Java virtual machine (JVM) for your container)

-Xmx256M -Xms48m

"Allocates extra memory to your server. By default, JVM will use only 64MB of heap. If you’re serving just vector data, you’ll be streaming, so having more memory won’t increase performance. If you’re serving coverages, however, JAI will use a disk cache. -Xmx256M allocates 256MB of memory to GeoServer (use more if you have excess memory). It is also a good idea to configure the JAI tile cache size (see the Server Config page in the Web Administration Interface section) so that it uses 75% of the heap (0.75). -Xmx48m will tell the virtual machine to grab a 48MB heap on startup, which will make heap management more stable during heavy load serving."

-XX:MaxPermSize=128m

"Increases the maximum size of permanent generation (or “permgen”) allocated to GeoServer to 128MB. Permgen is the heap portion where the class bytecode is stored. GeoServer uses lots of classes, and it may exhaust that space quickly, leading to out of memory errors. This is especially important if you’re deploying GeoServer along with other applications in the same container, or if you need to deploy multiple GeoServer instances inside the same container."

http://docs.geoserver.org/stable/en/user/production/container.html

share|improve this answer
    
Thanks; I found this previously but it didn't help me much. From my unfamiliar-with-this-stuff point of view, it doesn't tell me what to edit in my Ubuntu VM - where do I put those switches? Where do I find the 'performance settings in the Java virtual machine (JVM) for your container'? –  Elliveny May 31 '11 at 15:20
    
Well, to my understanding the options you mentioned are valid for Oracle's JVM, that is, not standard, and even not stable. "Options that begin with -X are non-standard (not guaranteed to be supported on all VM implementations), and are subject to change without notice in subsequent releases of the JDK. Options that are specified with -XX are not stable and are not recommended for casual use. These options are subject to change without notice." (oracle.com/technetwork/java/javase/tech/…). The question has problem: Elliveny is not telling us what JVM is using. –  dariapra Jun 2 '11 at 17:43
    
Java is owned by oracle - en.wikipedia.org/wiki/Java_%28programming_language%29 So GeoServer should be bundling extensions with the package. I found all the extensions for oracle connections disjointed but did get it to work. –  Mapperz Jun 2 '11 at 19:20
    
@Mapperz Java is not owned by Oracle. There are a lot of implementations of JVM. but the more famous implementation is Oracle JVM. List (not complete) of JVM implementations: en.wikipedia.org/wiki/List_of_Java_virtual_machines –  angelcervera Nov 12 '12 at 9:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.