I am using below parameters to override my heap config for JVM -
JBP_CONFIG_OPEN_JDK_JRE: '[memory_calculator: {memory_heuristics: {heap: 65, metaspace: 20}}]'
But I am not able to see the changes getting reflected. Can someone help?
The options you're using only apply for version 3.x of the Java buildpack.
Starting with Java buildpack 4, all you need to do is to set JAVA_OPTS with your JVM configuration options. So if you want to override the max heap size and change the thread stack size, you can do cf set-env my-app JAVA_OPTS '-Xmx100m -Xss228k'.
The Java buildpack will read these values and attempt to adjust the other areas of memory used by the JVM so that it can accommodate running your app within the defined memory limit. If it cannot do that, the Java buildpack will print an error telling you this.
For example, if you set the memory limit to 512M and you set a max heap of 500M, that's not going to work. There won't be enough memory left for other areas of the JVM and the JBP will reject your settings. This is a safety check so to keep your application from exceeding the memory limit and crashing at some point in the future.
Related
I have been trying to run 50 users in Jmeter, but I see Java.Lang OutOfMemory error in the command prompt once the number of users crosses 35. My machine has a physical memory of 16GB and in-spite of increasing the heap size to 8GB(8192m) in the jmeter.bat file, I still happen to see the same error. I have also disabled the listeners to reduce the memory consumption as well and I used the below heap commands to increase its size.
set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=8192m
I also used a few more alternative commands to increase the heap size which are:
set HEAP="-Xms2g -Xmx2g -X:MaxMetaspaceSize=512m" && jmeter.bat
HEAP="-Xms512m -Xmx4096m"
But I happen a see another error stating
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
errorlevel=1
Can anybody help me in resolving this issue for running a test with 50 users successfully?
Make sure that you have 64-bit Java installation, you won't be able to allocate more than 2 gigabytes to 32-bit JVM
Make sure to use proper syntax as you made a typo and it doesn't looks like you know what you're really doing (setting too high metaspace size will rather cause the problems than fix them):
OutOfMemoryError Exception can have many faces, it's not necessarily connected with insufficient heap, read the stacktrace and eventual .hprof file more attentively
Make sure to follow recommendations from the 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article
I am using Web logic 10.3.6 and Java 1.7.
My application is running out memory if keep heap space Xmx512m and Web logic is not able to acquire enough memory space when in am increasing to Xmx2048m.
First I have tried with WLS_MEM_ARGS_32BIT=-Xms256m -Xmx512m
For this my application is going out of memory at the server start up giving below error in console:
<Jan 26, 2019 4:42:55 PM EST> <Error> <HTTP> <BEA-101216> <Servlet: "InitializerServlet" failed to preload on startup in Web application: "myApp.war".
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2367)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415)
at java.lang.StringBuffer.append(StringBuffer.java:237)
Truncated. see log file for complete stacktrace
>
<Jan 26, 2019 4:42:55 PM EST> <Error> <Deployer> <BEA-149231> <Unable to set the activation state to true for the application '_appsdir_myApp_war'.
weblogic.application.ModuleException: [HTTP:101216]Servlet: "InitializerServlet" failed to preload on startup in Web application: "CUEPrepAndRating.war".
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2367)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:415)
at java.lang.StringBuffer.append(StringBuffer.java:237)
the server doesn't start if I increase the heap space to set WLS_MEM_ARGS_32BIT=-Xms256m -Xmx2048m
and give below error message:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Can you some one help how I can increase my web logic heap space enough(4GB) so that my application will run without the going out of memory.
You can't. At least not with a 32-bit JDK. See: Maximum Java heap size of a 32-bit JVM on a 64-bit OS - you will not get higher than -Xmx1600m.
I'm developing a GWT application, and I'm having issues with testing in development mode in eclipse.
When I make changes to the client-side code, I refresh the browser page (F5) to reload the module. Every time I do this (whether the code has changed or not), the Development Tab in eclipse shows a new bullet point with "Module xxxx has loaded". As well, according to Task Manager, every time I do this, the javaw.exe host process increases by about 1MB of memory. Eventually (10-20 refreshes later), the page fails to load and the Development Mode tab shows this error:
Out of memory; to increase the amount of memory, use the -Xmx flag at startup (java -Xmx128M ...)
I can fix this by stopping and restarting the server (not the little refresh button in the Developer Mode tab, but the red stop button), but it then the module has to be revalidated, which takes a while. It seems that eclipse doesn't realize I've finished with the old module when I reload a new one. I'm observing the same behavior with a brand-new GWT project, so I don't think it's my code. Is anyone aware of a way to remedy this?
EDIT: See both answers below for possible solutions.
The default settings gwt dev mode use are the minimum , so you hit an out of memory really quickly.
From this you can see that the permgenspace is to low and if you refresh 20 times in a short periode it will go out of memory.
you can start by using following vmargs :
-Xms512m -Xmx512m -XX:MaxPermSize=256M -XX:+UseParallelGC
But as enrybo pointed out if your application grows it requires more memory:
-Xms512m -Xmx1g -XX:MaxPermSize=256M -XX:+UseParallelGC
There isn't really all that much you can do. As you mentioned you can increase the memory but eventually you'll run into the same problem even with more allocated memory.
I suggest you try to run in Super Dev Mode but in that case you'll need to update the SDK you're using to 2.5.1+. With Super Dev Mode your browser does not need a plugin because it will actually be running true Javascript. You even have the ability to debug in your browser but looking at your Java source (using source maps).
.Net winform application.
I used several memory profiler, including CLR profiler, DotTrace memory, Net memory profiler.
The tools gave the result that the allocated memory was 38-40M. But I found that working set was 300-400M in task manager(almost the same size as Peak working set or memory or commit size.
So what's the difference between the two results? What do the results mean?
those tools may show you private bytes or managed heap size, this does not include, e.g. memory mapped file, either page file backed or disk file backed, your app may be r/w ing
big mapped file, so working set looks big, or your app just load too many dll/assemblies.
VMMAP (from sysinternals) can give a clear overview of memory type/size in your app.
I've run into a few OutOfMemoryExceptions with my C#/WPF application and I'm running into some confusing data while attempting to profile the memory usage.
When the app is typically running, Windows Task Manager shows the memory usage as somewhere around 34 MB (bounces around slightly as objects are created and garbage collected). When I run memory profiling applications such as CLR Profiler and dotTrace Memory, they show the total memory usage at around 1.2 MB.
Why this huge discrepancy? What does Task Manager see that these profilers do not?
UPDATE: I added some diag code to my application to print out various memory information every so often via the Process class.
While running my app, I set up a rule in DebugDiag to perform a memory dump in the event of an exception. I forced an exception and the memory dump occurred. At this point, the memory usage of my app (as shown by task manager) jumped from 32 MB to 145 MB and remained there.
You can see this jump in the table below (WorkingSet64). I'm still trying to make sense of all the types of memory info provided by the Process class. How would an external application make the working set of my app grow like this?
Link to data table here.
Using some of the diagnostics tools suggested here, plus the ANTS memory profiler (which is so money) I found the source of the leak.
WPF Storyboard animations leak under .NET 3.5
The WPF BitmapEffect class can cause leaks. The alternative "Effect" class fixes the leak. Link, Link
XAML Merged ResourceDictionaries can cause leak. Link, Link
The "Working Set" memory footprint of an application (memory shown by task manager) is not a good indication of your process' footprint. Outside applications can influence this. Link
The memory profiling tools helped me find that the leaks were mostly in unmanaged code, which made it a real pain to track down. Dealing with these leaks, plus a better understanding of Windows memory (private vs working set) cleared things up.
Prcess Explorer and VMMap, both part of the Sysinternals Suite by Mark Russinovich.