out-of-memory

java.lang.OutOfMemoryError when reading from a large table

筅森魡賤 提交于 2019-12-07 17:29:35
问题 I'm trying to pre generate reports from a very large table(300GB) in PostgreSQL. I do something like this: rs = stmt.executeQuery("SELECT * FROM tbl"); System.out.println("select all finished"); while (rs.next()) { /* generate report and save it in report table */ /* generated reports are not in memory, * They are saved in a summary table in each iteration */ } When I start the application it gives Exception in thread "main" java.lang.OutOfMemoryError: Java heap space . I tried to use stmt

OutOfMemoryException only in Release mode when compiled with VS2010?

非 Y 不嫁゛ 提交于 2019-12-07 16:50:22
问题 My program generates OutOfMemoryExcetion only in Release mode, compiling with VS2010 C# compiler. The operation that it was performing when the crash occurred was instantiating 1600 jagged arrays, and it broke when at the 207th of the simplified version of the loop below: Double[][] arr = new Double[1600][]; int i = 0; while (i < 1600) { arr[i] = new Double[1000000]; i++; } Basically, just this part of code would generate ~ 11.9 GB, considering that a Double consumes 8 bytes. I don't have

JVisualVM Memory Sampling : Remote applications are not supported

烈酒焚心 提交于 2019-12-07 16:34:41
问题 I am trying to monitor remote tomcat process with JVisualVM in Red Hat Linux. CPU sampling works fine but Memory sampling tab is disabled. It says "Memory sampling: Not available. Remote applications are not supported" . Command line parameters of process: -Djavac.source=1.5 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=11107 JVisualVm details: Version: 1.6.0_24 (Build 100930);

Java collection and memory optimization

末鹿安然 提交于 2019-12-07 16:08:43
问题 I wrote a custom index to a custom table which uses 500MB of heap for 500k strings. Only 10% of the strings are unique; the rest are repeats. Every string is of length 4. How i can optimize my code? Should I use another collection? I tried to implement a custom string pool to save memory: public class StringPool { private static WeakHashMap<String, String> map = new WeakHashMap<>(); public static String getString(String str) { if (map.containsKey(str)) { return map.get(str); } else { map.put

Why MetaSpace Size is twice as big as Used MetaSpace?

吃可爱长大的小学妹 提交于 2019-12-07 16:08:28
问题 I wrote a program to simulate MetaSpace OOM. But I found that MetaSpace Size is almost always twice as big as Used MetaSpace . Why? I run my program with flag -XX:MaxMetaspaceSize=50m , the program throw OOM when Used MetaSpace reached about 25M rather than 50M, Why? 回答1: I think the following two experiment will explain what does the gap between MetaSpace Size and Used MetaSpace mean: EXP-1 : load one class per ClassLoader, I got this: EXP-2 : load five classes per ClassLoader, I got this:

NegativeArraySizeException when creating a SequenceFile with large (>1GB) BytesWritable value size

亡梦爱人 提交于 2019-12-07 15:44:44
问题 I have tried different ways to create a large Hadoop SequenceFile with simply one short(<100bytes) key but one large (>1GB) value (BytesWriteable). The following sample works for out-of-box: https://svn.apache.org/repos/asf/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapred/BigMapOutput.java which writes multiple random-length key and value with total size >3GB. However, it is not what I am trying to do

android. How to conserve memory with custom ArrayAdapters and ViewPagers

帅比萌擦擦* 提交于 2019-12-07 15:20:26
So I have a MainActivity with a View Pager. I create a nonstatic custom FragmentPageAdapter for the View Pager like this: public class CustomViewPageAdapter extends FragmentStatePagerAdapter { The Adapter has 4 items(fragments) Which I declare as global variables MainActivity as static so for example: static HotFragment hotFragment; Then I return hotFragment in my getItem() method of the FragmentStatePagerAdapter. Then in my HotFragment class I have another ViewPager as well as another FragmentStatePagerAdapter which is ALSO nonstatic: In the getItem() method of that Adapter return a new

Tools for OutOfMemoryError java heap space analysis

☆樱花仙子☆ 提交于 2019-12-07 15:14:19
问题 I am getting an OutOfMemoryError: Java heap space Are there any tools I can use to find the root cause ? 回答1: You can analyse the heap dump of your application using some analysis tool like eclipse mat to see what's consuming how much of the heap. But first you need to obtain the heap dump of your application. To have the JVM automatically generate the heap dump for you when the OOM error occurs you can use the -XX:+HeapDumpOnOutOfMemoryError option. On top of that, you can also use the -XX

Large HPROF file

百般思念 提交于 2019-12-07 13:17:19
问题 I have a very large Heap Dump (.hprof) file (16GB). When I try to open it in Visual Vm,the VM just hangs. I tried to open it in JProfiler. Jprofiler gave me a Out Of Memory error. Below is how my jprofiler.vmoptions looks like. What should be the ideal configuration, I should be using in order to open the HPROF without issues? I am running on a 8GB Linux box. -Xmx1536m -XX:MaxPermSize=128m -Xss2m 回答1: JProfiler 8.1 will be able to open much larger HPROF files without tuning the -Xmx VM

After an OOM how can I detect the pod that caused it?

落花浮王杯 提交于 2019-12-07 11:47:11
问题 I had some issues running some pods on a cluster, I want to know the way to detect which pod (and rc) is causing OOM on my nodes after the exception is thrown. I cannot access the node to check logs and kubectl describe node doesn't give me much information about this. Thanks :) 回答1: Have you try running kubectl get events --watch to monitor the events on k8s and monitor the pod as well with kubectl logs -f podname 回答2: The only way I found to track what is happening is waiting before an OOM