Question

I'm running Cygwin with Jetty and Solr431.

Here's the contents of my .bat file I use to start Solr:

@echo off
C:
chdir C:\cygwin\bin

bash -c "cd /cygdrive/c/Databases/apache-solr-3.5.0/example/; java -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar" 

After all is running a while the console window displays the error:

Java heap space out of memory

How can I see how much heap space is allocated right now and how can I increase it? I read that I need to add a parameter like -Xmx500M to the startup command, but I don't know where.

UPDATE

with jps command I found the correct PID.

Then I got these results. I thought the P column would show the permitted heapspace, but I don't see if my command parameters had any effect?

without any startup parameters

jstat -gcutil 4932 5000

  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT
100,00   0,00  74,91  65,67  99,23    300    0,348     4    0,146    0,494
100,00   0,00  74,91  65,67  99,23    300    0,348     4    0,146    0,494

with parameters

bash -c "cd /cygdrive/c/Databases/apache-solr-3.5.0/example/;java -Dsolr.solr.home="./example-DIH/solr/" -jar -Xmx200m -Xmx400m start.jar" jstat -gcutil 2548 5000

  S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT
  0,00  89,57  67,80  62,74  99,45    307    0,337     4    0,147    0,484
  0,00  89,57  67,80  62,74  99,45    307    0,337     4    0,147    0,484
Was it helpful?

Solution

You need to add the -Xmx500m just before start.jar.

Additional information -

Initial Heap size -Xms<size>
Maximum Heap size -Xmx<size>

To find out the Heap Size for the current running process you need jstat -gc <pid>. For details have a look here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top