heap-memory

Java slower with big heap

孤街醉人 提交于 2019-12-06 06:09:47
问题 I have a Java program that operates on a (large) graph. Thus, it uses a significant amount of heap space (~50GB, which is about 25% of the physical memory on the host machine). At one point, the program (repeatedly) picks one node from the graph and does some computation with it. For some nodes, this computation takes much longer than anticipated (30-60 minutes, instead of an expected few seconds). In order to profile these opertations to find out what takes so much time, I have created a

Android BitmapFactory.Options.inSampleSize casuse application crash

泪湿孤枕 提交于 2019-12-06 05:34:04
We are working on a Android app that captures images and converts the same to Bitmap to be posted to a Rest service. While creating the Bitmap we have BitmapFactory.Options.isSample Size configured to value of 4 and this works fine on all device except for HTC One. The image in HTC one is distorted. When we change the value to 1 it shows a good image on HTC one but the application crashes on all other devices because of Memory issues. The issue is related to Heap size available. What is the reason that HTC one shows a distorted image on HTC one. Why is application crashing on S3 which also has

JVM Heapsize on 32 bit OS

帅比萌擦擦* 提交于 2019-12-06 05:16:06
I am using 32 bit win.7 and using Eclipse. Also having 4GB RAM. I want to allocate my java application a maximum heapsize of around 3 GB, but I am able to allocate maximum 1.5GB through VM arguments -Xmx1056m . What should I do? If I Install a 64 bit win.7. it would be able then to allocate 3GB heapsize to my app? A regular 32-bit Windows process can only address 2GB of memory, even if you have more memory available. You can find the memory limits for different Windows versions here . Since the VM need memory for more things than just the heap, the max heap size will be slightly less than the

heap usage for CPS vs non-CPS parsers in Haskell's parsec

主宰稳场 提交于 2019-12-06 04:40:31
I'm trying to write the following parser using parsec : manyLength :: forall s u m a. Monad m => ParsecT s u m a -> ParsecT s u m Int manyLength p = go 0 where go :: Int -> ParsecT s u m Int go !i = (p *> go (i + 1)) <|> pure i This is like the many function, but instead of returning [a] , it returns the number of times Parser a succeeds. This works, but I can't seem to make it run in constant heap space. This makes sense, since the recursive call to go is not in the tail-call position. If parsec would export the constructor to ParsecT , it would be possible to rewrite manyLength in CPS'ed

Android Profiler vs Java API level memory calculation

给你一囗甜甜゛ 提交于 2019-12-06 03:45:30
问题 AFAIK android assigns heap limit based on OEM or Screen resolution of device and RAM it self. ex: samsung s5 128mb is limit. How to get current memory usage in android? Whereas the android Profiler shows that my app is eating more memory than > 128. OutOfMemory Line 160185: 12-08 11:22:18.332 I/art (11728): Alloc partial concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 0% free, 127MB/128MB, paused 2.012ms total 240.841ms Line 160325: 12-08 11:22:18.652 I/art (11728)

Java collection and memory optimization

被刻印的时光 ゝ 提交于 2019-12-06 02:55:37
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(str, str); return map.get(str); } } } private void buildIndex() { if (monitorModel.getMessageIndex() ==

google common cache - default value of maximumSize (and other “optional” settings) - want a cache that uses all “available” memory

。_饼干妹妹 提交于 2019-12-06 02:29:57
I just found Guava by searching for a cache API (it fits perfectly for my needs). But one question arose on reading the wiki and Javadoc - what are the default values of settings the CacheBuilder can take? The Javadoc states "These features are all optional" and "Constructs a new CacheBuilder instance with default settings, including strong keys, strong values, and no automatic eviction of any kind." In my opinion, a good default for maximumSize would be relative to Runtime.getRuntime().freeMemory(); At the end I want a cache that uses the memory available on a given system. So I need an

Process Heap Segments And Their Necessity

孤街浪徒 提交于 2019-12-05 21:54:39
While dumping heap of a win32 processes (Mostly in process which has high heap memory consumption like IE ) using !heap -a 004e0000 I find multiple segments of a particular heap like , Heap entries for Segment00 in Heap 004e0000 Heap entries for Segment01 in Heap 004e0000 Heap entries for Segment02 in Heap 004e0000 My questions are Question 1. Why its necessory to divide single heap into multiple segments ? Question 2. Most of the times I find a large gap between two segments. For example in below image Segment00 actually ends @ 0x005e0000 (Where un-commited bytes started) and Segment01

How java works in android through memory object heap allocation

时光毁灭记忆、已成空白 提交于 2019-12-05 21:38:54
I am new to Android but experienced in Java . In Java when we do this: MyClass myObj = new MyClass(); It clearly does the following: Inserts the memory pointer myObj upto the stack Allocates a new space for object of type MyClass in the heap Appoints this new space's reference to myObj But I am a little bit confused about the following questions: But in Android , does this work in the same way? Does Android have full stack and heap memories? Does Android have Java Virtual Machine (JVM) for my Java app ( Android app) to work on? Thanks a lot! Android re-implemented the Java Virtual Machine with

G1GC long pause with initial-mark

会有一股神秘感。 提交于 2019-12-05 19:56:45
With j7u5, G1GC "-Xms3200m -Xmx3200m -XX:+UseG1GC -XX:ParallelGCThreads=14 -XX:ConcGCThreads=4 -XX:MaxGCPauseMillis=40 -XX:NewRatio=2 -XX:SurvivorRatio=10 -XX:+PrintGC -XX:+PrintGCDateStamps" for a given performance test, my application hits a long pause after 5-hour run predictably. Except this big one (and only), there are small initial-mark phases. Any suggestions to figure out what is happening to this long pause and how to tune it to avoid such a long pause which affects the latency targets (percentiles 98%, 99.999%)? 2012-12-22T09:48:57.966+0000: [GC pause (young) 2436M->1460M(3200M), 0