garbage-collection

G1 gc log doesn't show clue for long gc pause

你离开我真会死。 提交于 2020-01-14 10:29:20
问题 I have a distributed cache application (memory bound, with networking I/O due to interaction with other nodes in the cluster) running in JVM 1.7.0_51 with G1 garbage collector. Here is the JVM configuration: -server -Xms1G -Xmx3000M -XX:+UseG1GC -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution -XX:+PrintHeapAtGC -XX:MaxGCPauseMillis=50 -Xloggc:$HAZELCAST_HOME/logs/gclog.txt -verbose:gc At 2014-08-21T16:32:16.032, GC

Weak reference with a condition / timeout

戏子无情 提交于 2020-01-14 08:10:50
问题 is it possible in Java to create a weak reference whose object can be sent to garbage collector only if a specified condition returns true ? Let's say that I have something like a cache which maps ID numbers to some data: Map<Integer, SomeData> cache = new HashMap<>(); SomeData have two important methods - void updateTime() , which just sets an internal variable to current time, and boolean canBeDeleted() , which checks if the object have or haven't been used in last 10 minutes (simply by

Weak reference with a condition / timeout

不问归期 提交于 2020-01-14 08:10:06
问题 is it possible in Java to create a weak reference whose object can be sent to garbage collector only if a specified condition returns true ? Let's say that I have something like a cache which maps ID numbers to some data: Map<Integer, SomeData> cache = new HashMap<>(); SomeData have two important methods - void updateTime() , which just sets an internal variable to current time, and boolean canBeDeleted() , which checks if the object have or haven't been used in last 10 minutes (simply by

Do I need to keep a strong reference to a WeakReference that is only used to perform finalization?

柔情痞子 提交于 2020-01-14 04:31:11
问题 I'd like to use a WeakReference as a more efficient finalize() method, for the purpose of freeing native resources associated with an object as soon as it becomes possible to do so, without using finalization (which has significantly higher costs than using a WeakReference). Since this is the only purpose of the WeakReference (I will never use the WeakReference to obtain the referenced object), it seems wasteful to take the time and space to maintain a list of my WeakReferences to prevent

Possible reasons for FileStream.Write() to throw an OutOfMemoryException?

依然范特西╮ 提交于 2020-01-13 18:39:28
问题 I have 10 threads writing thousands of small buffers (16-30 bytes each) to a huge file in random positions. Some of the threads throw OutOfMemoryException on FileStream.Write() opreation. What is causing the OutOfMemoryException ? What to look for? I'm using the FileStream like this (for every written item - this code runs from 10 different threads): using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite, BigBufferSizeInBytes, FileOptions

C# Disable garbage collection for USB ReadPipe

旧时模样 提交于 2020-01-13 11:43:16
问题 I am attempting to collect data from a USB port using D3XX.NET from FTDI. The data is collected and then sent to a fast fourier transform for plotting a spectrum. This works fine, even if you miss some data. You can't tell. However, if you then want to send this data to an audio output component, you will notice data missing. This is where my problem appears to be. The data is collected and then sent to the audio device. All packets are making it within the time span needed. However, the

C# Disable garbage collection for USB ReadPipe

。_饼干妹妹 提交于 2020-01-13 11:43:13
问题 I am attempting to collect data from a USB port using D3XX.NET from FTDI. The data is collected and then sent to a fast fourier transform for plotting a spectrum. This works fine, even if you miss some data. You can't tell. However, if you then want to send this data to an audio output component, you will notice data missing. This is where my problem appears to be. The data is collected and then sent to the audio device. All packets are making it within the time span needed. However, the

C# Disable garbage collection for USB ReadPipe

我只是一个虾纸丫 提交于 2020-01-13 11:42:52
问题 I am attempting to collect data from a USB port using D3XX.NET from FTDI. The data is collected and then sent to a fast fourier transform for plotting a spectrum. This works fine, even if you miss some data. You can't tell. However, if you then want to send this data to an audio output component, you will notice data missing. This is where my problem appears to be. The data is collected and then sent to the audio device. All packets are making it within the time span needed. However, the

Tweaking java classes for CPU cache friendliness

妖精的绣舞 提交于 2020-01-13 11:11:21
问题 When designing java classes, what are the recommendations for achieving CPU cache friendliness? What I have learned so far is that one should use POD as much as possible (i.e. int instead of integer). Thus, the data will be allocated consecutively when allocating the containing object. E.g. class Local { private int data0; private int data1; // ... }; is more cache friendly than class NoSoLocal { private Integer data0; private Integer data1; //... }; The latter will require two separate

Tweaking java classes for CPU cache friendliness

痞子三分冷 提交于 2020-01-13 11:09:10
问题 When designing java classes, what are the recommendations for achieving CPU cache friendliness? What I have learned so far is that one should use POD as much as possible (i.e. int instead of integer). Thus, the data will be allocated consecutively when allocating the containing object. E.g. class Local { private int data0; private int data1; // ... }; is more cache friendly than class NoSoLocal { private Integer data0; private Integer data1; //... }; The latter will require two separate