garbage-collection

Garbage collecting objects crossing AppDomain boundary

Hi, When you pass an object that inherits from MarshalByRefObject to a different AppDomain, won't GC.Collect() induced by the AppDomain that created it collect the object, provided that the object is not rooted in either AppDomain by the time GC.Collect() called? [When I say not rooted I mean no developer written code access it anymore...

Will Java's garbage collector go ahead and take care of variables declared within loops?

If I have: for (int i; i != 100; i++) { ArrayList<String> myList = buildList(); //... more work here } Do I have to set myList to null at the end of my loop to get the GC to reclaim the memory it uses for myList? ...

Can you repro this 64-bit .NET 4 GC bug?

Update: Microsoft have now reproduced the bug and are working on a fix. Whilst evaluating the viability of the .NET platform for low latency software development, we have discovered a serious bug in the .NET 4 concurrent workstation garbage collector that can cause applications to hang for up to several minutes at a time. On three of o...

GC Overhead limit exceeded error when reading a text file

Hello All, I am getting java.lang.OutOfMemoryError: GC overhead limit exceeded error when reading from a text file.I am not sure what is going wrong.I am running my program on a cluster having sufficient memory.The outer loop iterates for 16000 times and for each iteration of the outer loop the inner loop iterates for about 300,000 time...

TaskScheduler.UnobservedTaskException never gets called

Based on my research, I have learned the following: TaskScheduler.UnobservedTaskException must wait for the task to be garbage collected before that task's unobserved exception will bubble up to the UnobservedTaskException event. If you're using Task.Wait(), it'll never get called anyway, because you're blocking on an impending result ...

How to prevent PyQt objects from garbage collecting from different thread?

...

.NET pre-allocating memory vs ad-hoc allocation

Hi, I'm working on some applications that require very low latency and push a lot of memory and was doing some testing of how e.g. allocating a list ad-hoc vs. pre-allocating and clearing a list performs. I was expecting the test runs that pre-allocate the memory to perform a lot faster but to my surprise they're actually slightly slowe...

Delphi automatic garbage collector

Is it possible to think to have in future an automatic garbage collector in Delphi? There are many applications in which a higly detailed control on when to free an object is not so important and it is just an extra thing to care about. For such applications having a kind of garbage collector that works like java's one would be interest...

Tradeoff of creating collection on the fly or beforehand.

Whats the pro's and con's of creating a collection instance on the fly or beforehand, during initialisation for use later. I have a whole bundle of threads that each need to output a buffer which is enqueued on a priority or intervalheap queue. I was wondering if it would be more effecient in c# to create, a circular buffer of type X, ...

Why do I get OutOfMemory Exceptions although the memory could be freed?

Hello everybody, I stumbled upon an OutOfMemory-Exception when working with lots of pictures (sequentially, not in parallel). I reproduced the behavior in some small portion of code like this: class ImageHolder { public Image Image; ~ImageHolder() { Image.Dispose(); } } public partial class Form1 : Form { ...

Android: the GC doesn't respect SoftReferences?

It seams that Dalvik's garbage collector doesn't respect SoftReferences and removes them as soon as possible, just like WeakReferences. I'm not 100% sure yet, but despite the fact that there is still ~3MB of free memory my SoftReferences get cleared after I see "GC freed bla-bla-bla bytes" in LogCat. Also, I saw a comment by Mark Murphy...

Java blocking issue: Why would JVM block threads in many different classes/methods?

Hi all, Update: This looks like a memory issue. A 3.8 Gb Hprof file indicated that the JVM was dumping-its-heap when this "blocking" occurred. Our operations team saw that the site wasn't responding, took a stack trace, then shut down the instance. I believe they shut down the site before the heap dump finished. The log had no errors/ex...

.NET Garbage Collector difference between x86 / x64. x64 doesn't collect.

I have a WPF application which doesn't seem to garbage collect on x64 systems. I have tested it carefully on x86 machines and I am confident it isn't a programming problem, the memory usage will grow and then will be garbage collected as I expect. a) Some users access the application via terminal services on x64 Windows 2008 which is a ...

Javamail does not completely close socket on timeout

When sending a mail trough javamail, a socket to the smtp server is opened. Now, we got the case, that the connection of the mail server went down while the connection was still alive and while javamail was waiting for the server (spam scanning took a few seconds). Therefor the TCP connection was never really closed and the client deadlo...

What is going on here? (.Net) GC.CollectionCount(0) keeps increasing.

While testing application performance, I came across some pretty strange GC behavior. In short, the GC runs even on an empty program without runtime allocations! The following application demonstrates the issue: using System; using System.Collections.Generic; public class Program { // Preallocate strings to avoid runtime allocatio...

Was there a specific reason garbage collection was not designed for C?

I have heard that it was suboptimal for C to automatically collect garbage -- is there any truth to this? Was there a specific reason garbage collection was not implemented for C? ...

Some questions on how code may influence the GC process

Hi, 1) Does adding a Dispose(), or finalize method, have any impact on making an object be GC'd soon? I ask this as my manager wrote some code, adding a finalize() method, in the hope it would be GC'd. But I argued that the object has to be "marked" for collection first, if it meets certain criteria. 2) Does writing "o = null" (where ...

Why are "A" or no output only possible outputs of this code, it could also be "AB"?

According to what I have read, the only possible outputs for this program are "A" or no printouts. But since the statement new MyString("A").concat("B"); is creating a new object with string "AB", couldn't this object also be garbage collected resulting in output "AB"? class MyString { private String str; MyString(String str)...

Why does exist WeakHashMap, but absent WeakSet?

Hi! From J. Bloch A ... source of memory leaks is listeners ... The best way to ensure that callbacks are garbage collected promptly is to store only weak references to them, for instance, by storing them only as keys in a WeakHashMap. So, why there isn't any WeakSet in java collection framework? Thanks. ...

Chrome fails to free memory, garbage collection doesn't occur as expected (Mootools/MochaUI library)

Background: I'm currently working on an intranet site that makes use of the MochaUI library (working from the virtual desktop demo). I'm using Mootools 1.2.4 and MochaUI 0.9.7. The windows that are opened in my "virtual desktop" implementation load their content via iframes. Some of the loaded pages are pretty hefty in terms of css and s...