heap-memory

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

橙三吉。 提交于 2019-11-26 23:18:16
问题 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. 回答1: 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

C++ delete does not free all memory (Windows)

烈酒焚心 提交于 2019-11-26 22:24:09
问题 I need help understanding problems with my memory allocation and deallocation on Windows. I'm using VS11 compiler (VS2012 IDE) with latest update at the moment (Update 3 RC). Problem is: I'm allocating dynamically some memory for a 2-dimensional array and immediately deallocating it. Still, before memory allocation, my process memory usage is 0,3 MB before allocation, on allocation 259,6 MB (expected since 32768 arrays of 64 bit ints (8bytes) are allocated), 4106,8 MB during allocation, but

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

隐身守侯 提交于 2019-11-26 21:21:57
问题 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

Why a sawtooth shaped graph?

半世苍凉 提交于 2019-11-26 20:37:17
问题 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?

Java heap space out of memory

≯℡__Kan透↙ 提交于 2019-11-26 20:19:48
My application currently consumes quite a lot of memory because it is running physics simulations. The issue is that consistently, at the 51st simulation, java will throw an error usually because of a heap space out of memory (my program eventually runs thousands of simulations). Is there anyway I can not just increase the heap space but modify my program so that the heap space is cleared after every run so that I can run an arbitrary number of simulations? Thanks -edit- Thanks guys. Turns out the simulator software wasn't clearing the information after every run and I had those runs all

What is the largest possible heap size with a 64-bit JVM?

别说谁变了你拦得住时间么 提交于 2019-11-26 20:17:20
The theoretical maximum heap value that can be set with -Xmx in a 32-bit system is of course 2^32 bytes, but typically (see: Understanding max JVM heap size - 32bit vs 64bit ) one cannot use all 4GB. For a 64-bit JVM running in a 64-bit OS on a 64-bit machine, is there any limit besides the theoretical limit of 2^64 bytes or 16 exabytes? I know that for various reasons (mostly garbage collection), excessively large heaps might not be wise , but in light of reading about servers with terrabytes of RAM, I'm wondering what is possible . If you want to use 32-bit references, your heap is limited

How detect and remove (during a session) unused @ViewScoped beans that can't be garbage collected

五迷三道 提交于 2019-11-26 20:15:28
问题 EDIT: The problem raised by this question is very well explained and confirmed in this article by codebulb.ch, including some comparison between JSF @ViewScoped , CDI @ViewSCoped , and the Omnifaces @ViewScoped , and a clear statement that JSF @ViewScoped is 'leaky by design': May 24, 2015 Java EE 7 Bean scopes compared part 2 of 2 EDIT: 2017-12-05 The test case used for this question is still extremely useful, however the conclusions concerning Garbage Collection in the original post (and

Why do we even need the “delete[]” operator?

巧了我就是萌 提交于 2019-11-26 18:23:13
问题 This is a question that's been nagging me for some time. I always thought that C++ should have been designed so that the "delete" operator (without brackets) works even with the "new[]" operator. In my opinion, writing this: int* p = new int; should be equivalent to allocating an array of 1 element: int* p = new int[1]; If this was true, the "delete" operator could always be deleting arrays, and we wouldn't need the "delete[]" operator. Is there any reason why the "delete[]" operator was

Tomcat 7: How to set initial heap size correctly?

半腔热情 提交于 2019-11-26 18:07:07
问题 I was trying to adjust initial heap size of a tomcat 7 (CentOS, java -version: 1.6.0_25-b06) instance by adding the following line to catalina.sh: export CATALINA_OPTS="-Xms=512M -Xmx=1024M" Starting up tomcat fails and logs the following message to catalina.out: Invalid initial heap size: -Xms=512m Could not create the Java virtual machine. What is wrong with these options? 回答1: You must not use = . Simply use this: export CATALINA_OPTS="-Xms512M -Xmx1024M" 回答2: Use following command to

PySpark: java.lang.OutofMemoryError: Java heap space

大憨熊 提交于 2019-11-26 16:31:21
问题 I have been using PySpark with Ipython lately on my server with 24 CPUs and 32GB RAM. Its running only on one machine. In my process, I want to collect huge amount of data as is give in below code: train_dataRDD = (train.map(lambda x:getTagsAndText(x)) .filter(lambda x:x[-1]!=[]) .flatMap(lambda (x,text,tags): [(tag,(x,text)) for tag in tags]) .groupByKey() .mapValues(list)) When I do training_data = train_dataRDD.collectAsMap() It gives me outOfMemory Error. Java heap Space . Also, I can not