heap-memory

How does Java garbage collector deals with circular references when their access path is broken?

ぃ、小莉子 提交于 2019-12-07 22:38:10
问题 I just want someone explain it to me that how does GC discover that those memory blocks (pictured in red area) are garbage when their reference count is more that 0 but they are practically inaccessible? 回答1: There's set of "root objects" which are considered always accessible: e.g., Thread references, static variables, class references. If some object can not be reached via link of references from these root objects, it considered to be available for GC, even if there are some references to

Memory allocation to executors and task in Spark

梦想的初衷 提交于 2019-12-07 18:03:17
问题 My cluster configuration is as below :- 7 Nodes each with 32 cores and 252 GB of memory. The yarn configurations are as below :- yarn.scheduler.maximum-allocation-mb - 10GB yarn.scheduler.minimum-allocation-mb - 2GB yarn.nodemanager.vmem-pmem-ratio - 2.1 yarn.nodemanager.resource.memory-mb - 22GB yarn.scheduler.maximum-allocation-vcores - 25 yarn.scheduler.minimum-allocation-vcores - 1 yarn.nodemanager.resource.cpu-vcores - 25 The map reduce configurations are as below :- mapreduce.map.java

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

Memory allocation by java

邮差的信 提交于 2019-12-07 14:41:29
问题 Problem : I have setted Xms512m and Xmx1024m for running application which intern use C++ native layer for performing other operation, I am getting OutOfMemory exception when running application. I need to know C++ uses which memory (ie from assigned memory Xms512m and Xmx1024m or it uses other than this setted memory). How to get heap space and stack space for Java and C++ code while running application separately. 回答1: The memory allocated by native code is not in the Java Heap. Your

How java works in android through memory object heap allocation

不羁岁月 提交于 2019-12-07 12:53:50
问题 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

CLR Profiler and 0 Heap Statistics

僤鯓⒐⒋嵵緔 提交于 2019-12-07 07:48:09
问题 Why would I get 0 for my heap statistics allocation for an ASP.NET MVC web application with CLR profiler? 回答1: I was getting zeroes, but I think doing these two things solved the issue of zeroes: make sure you have "Allocations" checked in the "Profile" section and be sure to end the application before trying to see the profiling info. Either end it through CLR Profiler ("Kill Application") or from within the application itself. I believe both of those things were required to make it work for

malloc like function using custom heap

爱⌒轻易说出口 提交于 2019-12-07 06:33:41
问题 What would be the best approach in C if I wish to construct malloc like functionality with a custom pre-allocated heap? My specific issue here is that I have a mmap-able (memory like) device which has been placed into my address space but I need to attain a more flexible way of using this memory to store objects which will be allocated and freed over time. I know that malloc, free and the other similar functions are used to perform this kind of allocation on the heap but is there any way to

Finding Memory Requirements of Java Application

≯℡__Kan透↙ 提交于 2019-12-06 15:53:56
We have a desktop Java Swing application. For shipping it, we need to specify the minimum memory requirements for deploying this application. In the JVM parameters we specify 2GB as max heap size. Is there any tool for a Windows based machine which can quantify the requirements? Also, as follow-up question, I would like to know: If we do not specify the max heap size in Java 7, does the JVM still automatically adjust the heap size on the fly before throwing an OutOfMemoryError? Markus Weninger Possible approach: If you specify your own product to work with at max. 2GB of heap, you also have to

Address of a Global Variable in the Heap Address Range

旧巷老猫 提交于 2019-12-06 10:49:23
I was debugging the MPlayer-1.3.0 source code, and I saw a global variable whose address (returned by GDB or even simple printing) was in the range for the heap allocations, instead of the data section. I checked the heap range using procfs . 555555554000-555555834000 r-xp 00000000 08:12 798876 /usr/bin/mplayer 555555a33000-555555b25000 r--p 002df000 08:12 798876 /usr/bin/mplayer 555555b25000-555555b2b000 rw-p 003d1000 08:12 798876 /usr/bin/mplayer 555555b2b000-555556479000 rw-p 00000000 00:00 0 [heap] 7fffc3fff000-7fffc8000000 rw-s 00000000 00:16 1932 /dev/shm/pulse-shm-3887887751 The

How does Java garbage collector deals with circular references when their access path is broken?

两盒软妹~` 提交于 2019-12-06 07:46:05
I just want someone explain it to me that how does GC discover that those memory blocks (pictured in red area) are garbage when their reference count is more that 0 but they are practically inaccessible? There's set of "root objects" which are considered always accessible: e.g., Thread references, static variables, class references. If some object can not be reached via link of references from these root objects, it considered to be available for GC, even if there are some references to that object. GarbageCollector works based on Java Memory Model. In java available application memory is