heap-memory

What is the difference between xmx and MaxRAM JVM parameters?

我怕爱的太早我们不能终老 提交于 2019-11-28 04:11:42
问题 MaxRAM: based on the amount of memory on the machine. The proportion of memory to use for the heap is controlled by the command-line options InitialRAMFraction and MaxRAMFraction [...] The value of MaxRAM is platform-dependent. Xmx: -Xmxn Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. The upper limit for this value

Is it required that a C Variable Length Array is allocated from the stack?

时光怂恿深爱的人放手 提交于 2019-11-28 03:51:43
问题 After removing all the calls to malloc and calloc from our code for an embedded system, I was surprised to find that malloc was still being linked in. The call graph pointed me to a function which had no explicit *alloc calls, and no calls to any library functions that might allocate, like strdup . I had to look at the generated assembly to realize that it was due to an inlined function which contained a VLA. I thought VLAs had to be stack-allocated. Is this compiler broken? 回答1: There is no

Thread-specific heap allocation

一笑奈何 提交于 2019-11-28 03:28:32
问题 Is it possible to make some sub-set of threads (e.g. from specific ThreadPool) allocate memory from own heap? E.g. most of the threads are allocating from regular shared heap, and few worker threads are allocating from individual heaps (1:1 per thread). The intent is to ensure safe execution of the code in shared environment - typical worker is stateless and is running on separate thread, processing of one request should not consume more than 4MB of heap. Update #1 Re: But why are you worried

Young , Tenured and Perm generation

陌路散爱 提交于 2019-11-28 02:53:50
I'm confused with Heap,Young,Tenured and Perm generation. Could anyone please explain? Tendayi Mawushe The Java garbage collector is referred to as a Generational Garbage Collector . Objects in an application live for varying lengths of time depending on where they are created and how they are used. The key insight here is that using different garbage collection strategies for short lived and long lived objects allows the GC to be optimised specifically for each case. Loosely speaking, as objects "survive" repeated garbage collections in the Young Generation they are migrated to the Tenured

Thread '<main>' has overflowed its stack when allocating a large array using Box

若如初见. 提交于 2019-11-28 02:14:46
I'm implementing combsort . I'd like to create fixed-size array on the stack, but it shows stack overflow . When I change it to be on the heap (Rust by Example says to allocate in the heap we must use Box ), it still shows stack overflow . fn new_gap(gap: usize) -> usize { let ngap = ((gap as f64) / 1.3) as usize; if ngap == 9 || ngap == 10 { return 11; } if ngap < 1 { return 1; } return ngap; } fn comb_sort(a: &mut Box<[f64]>) { // previously: [f64] let xlen = a.len(); let mut gap = xlen; let mut swapped: bool; let mut temp: f64; loop { swapped = false; gap = new_gap(gap); for i in 0..(xlen -

programmatically setting max java heap size

时光怂恿深爱的人放手 提交于 2019-11-28 01:57:08
Is there a way to set the max java heap size programmatically instead of as a vm argument? Something like: System.getProperties().put("<heap variable>", "1000m"); Not with any Hotspot JVM. The JVM heap parameters can only be specified on the command line, and are then fixed for the lifetime of the JVM. With Hotspot Java implementations, the only way to "change" the heap size of an application is to relaunch it in a new JVM with different command line parameters. (I vaguely recall that JVMs from some other vendors do allow some heap parameters to be changed in a running JVM. Perhaps someone can

How do I see memory allocation in a given .NET application?

好久不见. 提交于 2019-11-27 23:19:18
I need to check how much memory is allocated in the heap. Is there a way to get this value programmatically with C#? I know about the System.Runtime.InteropServices.Marshal.SizeOf(...) but that only tells me the size of an object. Using a PerformanceCounter you can query the "# Bytes in all Heaps", from your own process, and even other processes. Use the Category ".Net CLR Memory" to see a lot of counters available. You have to see what the difference in system load is between the PerformanceCounter and the GC.GetTotalMemory that is proposed by Jon Skeet. Does GC.GetTotalMemory do everything

java.exe process uses more memory and does not free it up

浪尽此生 提交于 2019-11-27 23:10:52
I have a java application which when in idle state before any complex executions, uses 23 MB in Heap and the java.exe process size in TaskManager was around 194 MB. After some complex operations, the size of java.exe grew up to around 500MB and the heap size also grew up. The Heap size is reduced back to 23MB after a few full GC by calling System.gc() method. But the size of java.exe reduced to around 237MB from around 600MB which still have around 43 MB of data in it. Is there a way to reduce this? Or is that due to some behavior? This is normal, don't worry. JVM acquires memory when it needs

Why a sawtooth shaped graph?

孤街醉人 提交于 2019-11-27 21:18:58
When I run the below mentioned code using NetBeans, the allocated heap size graph resembles a sawtooth shape. I am attaching the screen capture from JVisualVM which shows the heap allocation graph in with a sawtooth shape. The program is a simple infinite loop printing "Hello, World!" into the console. public class HelloWorld { public static void main(String a[]){ while(true) { System.out.println("Hello, World!"); } } } Can anyone explain the reason behind the shape of the graph of used heap? PS : This happens even if I run it without using NetBeans, so it is most likely not related to

How to increase the memory heap size on IntelliJ IDEA?

浪子不回头ぞ 提交于 2019-11-27 21:14:07
I want to allocate around 1GB of heap size, but I can't seem to figure it out. How to do this? Use Help | Edit Custom VM Options… An editor will open automatically for the right .vmoptions file, adjust the value of -Xmx , save and restart IntelliJ IDEA: Check these documents from IntelliJ IDEA knowledge base for more details: Configuring JVM options and platform properties The JVM could not be started. The main method may have thrown an exception . Answers below suggest to edit .vmoptions file directly inside the application installation directory. Please note that it's not recommended since