garbage-collection

Am I closing this SQL connection in a C# function appropriately?

烈酒焚心 提交于 2020-01-03 18:37:08
问题 In an attempt to close my question on connections remaining open and exceeding the maximum pool, I'm trying tor rewrite the function that is used to connect to our database. The function exists within a homegrown compiled library. using reflector I can see the code looks like this: public SqlProvider([Optional, DefaultParameterValue("")] string StrConnection) { string str; if (StrConnection == "") { str = ConfigurationSettings.AppSettings["ConStr"]; } else { str = StrConnection; }

How to list all object in GC finalization list?

て烟熏妆下的殇ゞ 提交于 2020-01-03 17:27:25
问题 I have crash in my program, it is a visualizer for VS, so, it is very hard to debug it, i have tried to make dump and use WinDbg to study it, but it unsuccessful. So, now i try to put my hands on that list programmatically, but i don't know how. Thanks. 回答1: I do not think that there is a way to get at the finalization queue via .NET's managed Framework Class Library (FCL). I suspect that if you want to do this programmatically instead of debugging with WinDbg, you (just like WinDbg and

How to list all object in GC finalization list?

天涯浪子 提交于 2020-01-03 17:26:12
问题 I have crash in my program, it is a visualizer for VS, so, it is very hard to debug it, i have tried to make dump and use WinDbg to study it, but it unsuccessful. So, now i try to put my hands on that list programmatically, but i don't know how. Thanks. 回答1: I do not think that there is a way to get at the finalization queue via .NET's managed Framework Class Library (FCL). I suspect that if you want to do this programmatically instead of debugging with WinDbg, you (just like WinDbg and

How can I make data that is allocated manually be garbage-collected in Haskell?

浪子不回头ぞ 提交于 2020-01-03 09:45:25
问题 I'm thinking about a FFI calling some C functions from Haskell. If a memory buffer is used to hold some data and is allocated "manually" and then it is used in Haskell computations, can I somehow rely on the garbage collector to free it when it is not needed anymore. As for the manual allocations, there are basically two ways (but the difference doesn't seem to be essential for my question): allocating a buffer in Haskell, then passing it to C function, like in fdRead allocating a buffer in C

Prevent garbage collection for managed reference which is used in unmanaged code

三世轮回 提交于 2020-01-03 07:24:12
问题 My C# application uses wrapped C++ code for calculations. C++ header: __declspec(dllexport) void SetVolume(BYTE* data, unsigned int width); C++/CLI wrapper: void SetVolume(array<Byte>^ data, UInt32 width) { cli::pin_ptr<BYTE> pdata = &data[0]; pal->SetVolume(pdata, width); } C# : public startCalc() { byte[] voxelArr = File.ReadAllBytes("Filtered.rec"); palw.SetVolume(voxelArr, 490); //GC.KeepAlive(voxelArr); makes no sense } The C++ SetVolume function starts asynchronous calculations.

JAVA I/O: Unexpected Performance Difference between Sequentially and Concurrently Reading Files using BufferedReader

我怕爱的太早我们不能终老 提交于 2020-01-03 04:33:35
问题 I basically trying to load 6 large file (500MB per file on average) using buffered reader. In one run, I loaded the files one by one; In the other run, I loaded the files in parallel. There appeared to be a significant difference in term of time consumed by the two runs: Sequential Run: 14.634s Parallel Run: 120.317s NOTE that this difference shows up clearly on the 1st time reading these files into the JVM. In subsequent reads, duration shortens significantly, which I assume is due to

Spark: Incremental collect() to a partition causes OutOfMemory in Heap

岁酱吖の 提交于 2020-01-03 02:10:55
问题 I have a following code. Essentially I need to print RDD to a console, so I am collecting large RDD in smaller chunks by collecting it per partition. This is to avoid collecting entire RDD at once. When monitoring the heap and GC log, it seems like nothing is ever being GC'd. Heap keeps on growing until it hits OutOfMemory error. If my understanding is correct, in below once println statement is executed for collected RDDs, they won't be needed so it is safe to GC, but that's not what I see

How to detect a long gc from within a JVM?

*爱你&永不变心* 提交于 2020-01-03 00:20:09
问题 How can I detect a GC ( Edit or any stall) which exceeds some configured app timeout so that I can log a warning (or dynamically extend the timeout)? Edit I am not asking for alternatives or workarounds like monitoring. I am writing a library and I cannot control the environment or settings. Whilst I will clearly document that users of the library must set an appropriate timeout I still expect people to overlook that else change jvm heap settings years later and forget to increase the

How to stop Garbage collection in Android 2.3.3

拈花ヽ惹草 提交于 2020-01-02 20:10:43
问题 I have android application 2.3.3 use calendarView when press button => show dialog (contain calendarView) My logcat display: D/dalvikvm(15292): GC_CONCURRENT freed 1988K, 10% free 20024K/22087K, paused 4ms+3ms D/dalvikvm(15292): GC_CONCURRENT freed 1995K, 10% free 20022K/22087K, paused 4ms+3ms D/dalvikvm(15292): GC_CONCURRENT freed 1986K, 10% free 20029K/22087K, paused 4ms+3ms D/dalvikvm(15292): GC_CONCURRENT freed 2005K, 10% free 20023K/22087K, paused 4ms+3ms D/dalvikvm(15292): GC_CONCURRENT

Does the JS garbage collector clear stack memory?

一个人想着一个人 提交于 2020-01-02 11:07:16
问题 Following the first comment on this question: What makes this function run much slower? Does the garbage collector sweep stack memory? From what I've read, usually gc's don't do this. Following this question, I imagine that there is no physical difference between stack and heap memory; is there a virtual division? What I mean is: what happens when theoretically all stack memory is used without causing an overflow and new memory is allocated to an object after that? Could someone elaborate on