OutOfMemoryError: Java heap space on remote windows machine - out-of-memory

I have developed a java program which i have deployed on remote machine and it has latest jre1.8.0_60 installed. I have developed the program using jdk1.8.0_60. I have tested the program on my machine (memory 6GB-64bit) and on my colleagues computer (memory 8GB-64bit) and the program executed without any problem but when i execute the same program on remote machine(memory 4GB-64BIT) it throws this error:
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid3696.hprof ...
Heap dump file created [217326007 bytes in 2.721 secs]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Unknown Source)
at java.lang.String.<init>(Unknown Source)
at java.lang.StringBuilder.toString(Unknown Source)
at Invoice.GetInvoicesByStatusAndDate(Invoice.java:66)
at ClientSAAJ.GetInvoicesByStatusAndDate(ClientSAAJ.java:75)
at ClientSAAJ.main(ClientSAAJ.java:10)
Could it be that there is not enough ram or do i have carry out some sort of java configuration?

Your program is not having enough memory to operate. You can set maximum heap size using -Xmx jvm option.
e.g. If your program is an executable jar, to allocate maximum 80MB you can use
$java -Xmx80m -jar executatable.jar
See https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html for more information

#curiousprgrammer, i set the -Xmx80m to -Xmx1028m it seems like the issue is more realted to jvm then the actual pysical memory.

Related

Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory (Deploy, npm)

When to deploy in npm i have err code 134 and
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation
failed - JavaScript heap out of memory
I have NODE_OPTIONS --max_old_space_size=2048 and change on `setx NODE_OPTIONS --max_old_space_size=4096. But I didn’t solve the problem. During the previous deployment everything was fine.
I freed up more RAM and the deployment was successful. I hope this information will be useful to someone.

Grakn mem issue windows local installation

I don't have a tech background. I installed grakn locally on windows into a folder, I am able to start the server and use the workbase, however when I tried to do the compute query in the documentation tutorial (social_network), it throws an error:
2020-08-18 16:59:33,614 [transaction-listener] ERROR g.c.s.r.SessionService$TransactionListener - Runtime Exception in RPC TransactionListener: java.lang.IllegalArgumentException: System memory 259522560 must be at least 471859200. Please increase heap size using the --driver-memory option or spark.driver.memory in Spark configuration.
I then set env variables:
"SERVER_JAVAOPTS": -Xmx4G
"STORAGE_JAVAOPTS": -Xmx4G
Outcome nok:
Starting Storage....FAILED!
Unable to start Storage.
Process exited with code '1': 'Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Invalid maximum heap size: -Xmx4G
The specified size exceeds the maximum representable size.
An error has occurred during boot-up. Please run 'grakn server status' or check the logs located under the 'logs' directory.
Process exited with code '1': 'Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Invalid maximum heap size: -Xmx4G
The specified size exceeds the maximum representable size.
I then set env variables:
"SERVER_JAVAOPTS": -Xmx2G
"STORAGE_JAVAOPTS": -Xmx2G
Outcome again nok:
Starting Storage....FAILED!
Unable to start Storage.
Process exited with code '1': ''
An error has occurred during boot-up. Please run 'grakn server status' or check the logs located under the 'logs' directory.
Process exited with code '1': ''
I then set env variables to this:
"SERVER_JAVAOPTS": -Xmx1G
"STORAGE_JAVAOPTS": -Xmx1G
Outcome now is ok:
Starting Storage......SUCCESS
Starting Grakn Core Server.....SUCCESS
...but why can't I assign more mem? I have totally 32GB and usage is around 20%.
Many thanks in advance.
There are two possible reasons for this:
JVM is unable to allocate 4G of RAM because it's occupied by something else. However, as you've said only 20% or RAM is used, this is an unlikely reason.
32-bit JVM are unable to address more than 4GB of RAM 1, so you should check if it applies to you and reinstall your JVM to be 64-bit if it does.

how to solve java heap space out of memory issue in Solr

I am using Apache Solr version 4.6.0. I am getting out of memory exception when querying for name field. I am not very familiar with solr. I use it to search name . the core contains about 47M names. If anybody has encountered similar error, please share how you solved it. the error message is :
null:java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
at org.apache.solr.servlet.SolrDispatchFilter.sendError(SolrDispatchFilter.java:724)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:434)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:197)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1419)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:368)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:942)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1004)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
java ... -Xms1024m -Xmx1024m ...
Above allocate 1GB memory of heap size, if you have more physical memory then use it.
-Xms used for initial memory allocation pool.
-Xmx used for maximum memory allocation pool.
And recommended to set same value.
If still not fixed, then its time to search for memory leaks in your application.
read more about -X settings by run the command java -X
And remember to check your Java Virtual Machine version. If 32-bit or 64-bit version is installed. While the (theoretical) maximum heap size on the 32-bit is 4 GB and for 64-bit is 2^64 (which is looots of GB).

Java heap space (java.lang.OutOfMemoryError) Exception when i build ejb module on Netbean6.9.1

The system is out of resources. Consult the following stack trace for
details. java.lang.OutOfMemoryError: Java heap space
I have also updated this prems to
-Xmx1024m -Xmx2048m -XX:MaxPermSize=2048m
but still face same exception here...
Try increasing memory of netbeans.
In the etc directory under your Netbeans-Home, edit the file netbeans.conf file. -Xms and -Xmx should be increased to the values that allow your program to compile.
Here are the instructions in netbeans.conf:
Note that default -Xmx and -XX:MaxPermSize are selected for you
automatically. You can find these values in var/log/messages.log file
in your userdir. The automatically selected value can be overridden
by specifying -J-Xmx or
-J-XX:MaxPermSize= here or on the command line.
Put the values in the netbeans_default_options string.
Currently I have changed the Java plat from jdk 1.5 to Jdk 1.6 in Netbean properties
Now EJB build successfully.

ld.exe: final link failed: Memory exhausted while building qt

finally I've compiled qt from source,by using:
configure in qt's source folder, and then running mingw32-make.
But now I'm getting following error:
ld.exe: final link failed: Memory exhausted
I have 4GB ram, 1.3TB hard drive. How on earth is this possible. How shall I fix this problem so I can link those object files?

Resources