garbage-collection

Can I trigger PHP garbage collection to happen automatically if I have circular references?

I seem to recall a way to setup the __destruct for a class in such a way that it would ensure that circular references would be cleaned up as soon as the outside object falls out of scope. However, the simple test I built seems to indicate that this is not behaving as I had expected/hoped. Is there a way to setup my classes in such a wa...

How can I see which garbage collector java is using

The Java Virtual Machine supports several garbage collection strategies. This article explains them. Now I am wondering which (automatically selected) strategy my application is using, is there any way to let the JVM(version 1.6) print this information? Edit: The JVM detects if it is in client or server mode. So the question really i...

Associating an object with another object for GC clearup

Is there any way of associating an object instance (object A) with a second object (object B) in a generalised way, so that when B gets collected A becomes eligable for collection? The same behaviour that would happen if B had an instance variable pointing to A, but without explicitly changing the class definition of B, and being able to...

Asp.net cached objects staying in memory

I have a asp.net web forms app that uses System.Web.Caching.Cache to cache xml data from a number of web services for 2 hours. webCacheObj.Remove(dataCacheKey) webCacheObj.Insert(dataCacheKey, dataToCache, Nothing, DateTime.Now.AddHours(2), Nothing) Every 90 minutes a Microsoft Search Server hits a particular (spider) page which ...

Garbage collection of working environment?

Could anyone elaborate what work you are doing in garbage collection in daily corporate work? How much your considering garbage collection in your SDLC? ...

Divide and conquer of large objects for GC performance

At my work we're discussing different approaches to cleaning up a large amount of managed ~50-100MB memory.There are two approaches on the table (read: two senior devs can't agree) and not having the experience the rest of the team is unsure of what approach is more desirable, performance or maintainability. The data being collected is ...

Does Marshal.ReleaseComObject call the garbage collector ?

Hi, I was asked this question today by a colleague, and couldn't find any clue on the Internet... Can someone tell me if calling Marshall.ReleaseComObject()directly calls the garbage collector ? As I understand it, it only removes COM references, and then the G.C. cleans memory on its next pass, but I can be mistaken... Thanks in advan...

Lost String garbage collection

Lost String objects are memory wasters is it? How can garbage collection be invoked for the same? ...

Freeing Java memory at a specific point in time

Given this code, where we load a lot of data, write it to a file, and then run an exe.. void myMethod() { Map stuff = createMap(); //Consumes 250 MB memory File file = createFileInput(stuff); //Create input for exe runExectuable(file); //Run Windows exe } What is the best way to release the memory consumed by stuff prior...

Does a garbage collector collect stack memory, heap memory, or both?

I read lot of articles about garbage collection and almost all article tells about heap memory. so my question is "garbage collection collects stack memory or heap memory or both". thanks Kalpesh ...

How can I simulate this application hang scenario?

I have a Windows Forms app that itself launches different threads to do different kinds of work. Occasionally, ALL threads (including the UI thread) become frozen, and my app becomes unresponsive. I've decided it may be a Garbage Collector-related issue, as the GC will freeze all managed threads temporarily. To verify that just managed t...

Java -Xms initial size effects

Hi. What is the benefit of setting the -Xms parameter, and having the initial memory larger for example, then the default calculated one (64 MB in my case, according to Java GC tunning: http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#par_gc.ergonomics.default_size)? Also, is there any good to setting both the initia...

In WPF: Children.Remove or Children.Clear doesn't free objects

Update: I tried this on another, more cleanly installed, machine. I could not reproduce this on that machine. If I find out what offending (VSStudio) component causes this, I will let you know. I create some UIElements from code behind and was anticipating the garbage collection to clear up stuff. However, the objects are not free-ed at...

.NET: Any way to tell when an object is disposed/garbage collected?

Given an object, is there any way to get notified of when that object is garbage collected? I am playing around with having C# extension methods behave a little more like mixins (specifically in adding logging). So basically each object gets a new Logger() method which returns an ILog that is created and cached depending on the objec...

In .NET, will cleaning a nested dictionaries parent release all memory upon garbage collection?

I have the following nested dictionaries: Dictionary<int, Dictionary<string, object>> x; Dictionary<int, SortedDictionary<long, Dictionary<string, object>>> y; If I do x.Clear() and y.Clear() will all the nested objects clear and all the memory will be reused on the next garbage collection? Or do I need to iterate on all the items ...

AS3: why is this happening?

Hi, I just encounter a strange problem: var a:ClassA = new ClassA; var b:ClassA = a; The program keeps running sometime, the a = null, b = null. The program is a complex one, I am sure that no part will touch a, and b. My question is, will the runtime(garbage collector) to collect the memory of "a" and then assign a and b to null? ...

disable GC in AS3

Hi, I met a strange problem in AS3 and thought the problem may be caused by the GC, can I disable GC explicitly in AS3? Thanks. Bin ...

How GC collects resources in a static member in .NET?

I have a piece of code like this: Class Program { static StreamReader sr = null; static int var=0; static Program() { sr = new StreamReader("input.txt") } ~Program() { sr.Dispose(); } static void main(string args[]) { //do something with input here } } This may not...

Do fluent interfaces significantly impact runtime performance of a .NET application?

I'm currently occupying myself with implementing a fluent interface for an existing technology, which would allow code similar to the following snippet: using (var directory = Open.Directory(@"path\to\some\directory")) { using (var file = Open.File("foobar.html").In(directory)) { // ... } } In order to implement su...

Why does GC not clear the Dialog references?

I have a dialog. Every time I create it and then dispose, it stays in memory. It seems to be a memory leak somewhere, but I can't figure it out. Do you have any ideas? See the screenshot of heap dump for more information. Thanks in advance. http://img441.imageshack.us/img441/5764/leak.png ...