garbage-collection

IDisposable and managed resources [duplicate]

泪湿孤枕 提交于 2020-01-15 12:38:06
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Proper use of the IDisposable interface I have a class that has both managed and unmanaged resources. I am using IDisposable to release un-managed resources. Should I release managed resources in the dispose method? Or I can leave it to GC to release managed resources? 回答1: If you have a look at the following documentation you will find the line: Free any disposable resources a type owns in its Dispose method.

Why is garbage collection log Metaspace value different from provided flag?

本秂侑毒 提交于 2020-01-15 08:03:07
问题 I am running a server app on Java 8 with the below flags: -XX:GCLogFileSize=2097152 -XX:InitialBootClassLoaderMetaspaceSize=33554432 -XX:InitialHeapSize=1610612736 -XX:MaxHeapSize=1610612736 -XX:MaxMetaspaceSize=1073741824 -XX:MetaspaceSize=536870912 -XX:NumberOfGCLogFiles=5 -XX:+PrintGC -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+UseCompressedClassPointers -XX:

Does setInterval inside an object prevent garbage collection, when the object is deleted?

99封情书 提交于 2020-01-15 06:24:27
问题 I am working on a little Websocket project (using Socket.io), where I use a class like that: function myClass() { // start server sync window.setInterval(this.update.bind(this), 14); // listen for socket.io events io.on('my-event', doStuff); } There are multiple instances of that class stored in an array. After some time, the instances get deleted like that: myArr.splice(index, 1); The array is the only location, I store the instances in, so I thought, they would get deleted by the garbage

Shutting down JVM after 8 consecutive periods of measured GC thrashing

こ雲淡風輕ζ 提交于 2020-01-15 04:44:11
问题 I am writing Apache beam BAtch dataflow in which I am writing from GCS to BQ. My data contains 4 millions of records . I have specified n1-HighMem-8 machine type.My dataflow works form small amount of data. I my use case I schema is not fixed so I have used .getFailedInserts() Method to get schema failed records not inserted. I have grouped them and writing to BQ using BQ load job via GCS in same dataflow. for this amount of data I am geting following error 7 time and then my dataflow errors

Shutting down JVM after 8 consecutive periods of measured GC thrashing

别来无恙 提交于 2020-01-15 04:42:38
问题 I am writing Apache beam BAtch dataflow in which I am writing from GCS to BQ. My data contains 4 millions of records . I have specified n1-HighMem-8 machine type.My dataflow works form small amount of data. I my use case I schema is not fixed so I have used .getFailedInserts() Method to get schema failed records not inserted. I have grouped them and writing to BQ using BQ load job via GCS in same dataflow. for this amount of data I am geting following error 7 time and then my dataflow errors

card table and write barriers in .net GC

那年仲夏 提交于 2020-01-15 03:57:05
问题 Can anybody explain the concept of card table and write barriers in Garbage Collection process in .Net? I really can't get the explanation of these terms i.e what are they,how are they useful and how do they paticipate in GC. Any help would be really appreciated. 回答1: The card table is an array of bits, one bit for each chunk of 256 bytes of memory in the old generation. The bits are normally zero but when a field of an object in the old generation is written to, the bit corresponding to the

Too many Garbage collection threads

人盡茶涼 提交于 2020-01-14 17:56:39
问题 I am developing an software with java, it creates a thread upon receiving an event (from sensors). the time-to-live of these threads are very small (< 1 second) The sensor sends maximal 10 events/minute. This app works fine for the most of time. but some time it hangs. I look at eclipse debugger and find out that there are to many threads and most of them are "Thread[garbage collected]" (about 800 threads @_@) I don't know if that bug is caused by dynamic-creating-threads in my code or other

Too many Garbage collection threads

拟墨画扇 提交于 2020-01-14 17:54:13
问题 I am developing an software with java, it creates a thread upon receiving an event (from sensors). the time-to-live of these threads are very small (< 1 second) The sensor sends maximal 10 events/minute. This app works fine for the most of time. but some time it hangs. I look at eclipse debugger and find out that there are to many threads and most of them are "Thread[garbage collected]" (about 800 threads @_@) I don't know if that bug is caused by dynamic-creating-threads in my code or other

Why WeakReference.IsAlive becomes false?

删除回忆录丶 提交于 2020-01-14 14:46:09
问题 As a follow-up to this question, I have the following code: using System; using System.Runtime.InteropServices; namespace ConsoleApplication1 { class Program { class Child { public override string ToString() { return "I am a child!"; } ~Child() { Console.WriteLine("~Child called"); } } class Test { readonly object _child; readonly WeakReference _ref; readonly GCHandle _gch; // GCHandle is a value type, so it's safe public Test() { _child = new Child(); _ref = new WeakReference(_child); _gch =

Ninject WCF Garbage Collection on repositories

巧了我就是萌 提交于 2020-01-14 14:37:50
问题 I'm using Ninject 2.2 with the WCF extension. On most of my services the repositories are instantiated/released quickly. However, one of my services performs long-running operations (2-3 min). If I watch the w3wp process I can see the TCP/IP connections being established with SQL and I can run sp_who2 on SQL and see the connections. When these operations are complete, the connections remain open for 5-10 minutes. I don't see new connections being spawned when I run the operation multiple