garbage-collection

MovieClip isn't removed from Dictionary

I have a Dictionary where I hold data for movieclips, and I want the data to be garbage collected if I stop using the movieclips. I'm using the weak keys parameters, and it works perfectly with other data, however I've run into a problem. This code works great: var mc = new MovieClip(); var dic = new Dictionary(true); dic[mc] = 12; mc...

Java very large heap sizes

Does anyone have experience with using very large heaps 12 gb or higher in Java? Does the GC make the program ununable? What GC params do you use? Which jvm sun or bea would be better suited for this? Which platform linux or windows performs better under such conditions? In the case of windows is there any performance difference to be ...

Garbage collection in Flex when removeChild() is called - managing race conditions

I have a 'framework' in Flex which loads and destroys child 'sections', which are instances of module classes. These have a lot of webservice and animation in them and are part of a public facing site. Before I remove a section from the screen I call a 'hideSection()' interface method on the instance. In this method I fade out any contr...

What deterministic garbage collection algorithms are out there?

What deterministic garbage collection algorithms are out there? By deterministic I vaguely mean that can be used in critical real-time software like aerospace flight software. Garbage collectors (and dynamic memory allocation for that matter) are big no-no's in flight software because they are considered non-deterministic. However, I k...

Should you collect the young generation first in a full garbage collection?

I'm writing a program that contains a generational garbage collector. There are just two generations. What I wonder is: When doing a full collection, do I gain anything (performance-wise) by first collecting the younger objects, promoting the survivors to the old generation, and then collecting the old generation, or should I just garbag...

Java Concurrent and Parallel GC

This article here suggest to use -XX:+UseParNewGC 'To enable a parallel young generation GC with the concurrent GC'. My confusion is that to enable both parallel and concurrent gc do I just gotta use -XX:+UseParNewGC or do i gotta use both -XX:+UseParNewGC and -XX:+UseConcMarkSweepGC PS i am using jvm 6 ...

Does full userdata __gc metamethod need to free() it's memory?

I have a full userdata in Lua module written in C. The userdata has __gc() metamethod, which is called by garbage collector. Does lua interpreter free userdata memory after __gc() call, or do I have to free() it inside __gc()? ...

Garbage collection and runtime type information

The fixnum question brought my mind to an other question I've wondered for a long time. Many online material about garbage collection does not tell about how runtime type information can be implemented. Therefore I know lots about all sorts of garbage collectors, but not really about how I can implement them. The fixnum solution is act...

What's the point of the garbage collector

SqlConnection connection = new SqlConnection(FROM_CONFIGURATION) SqlCommand command = new SqlCommand("SomeSQL", connection); connection.Open(); command.ExecuteNonQuery(); command.Dispose(); connection.Dispose(); It is recommended that the code above should include try/catch (or using) so that if an exception is thrown, all resourc...

Memory Leaks in C# WPF

I could use some advice on tracking down the cause of memory leaks in C#. I understand what is a memory leak and I get why they occur in C# but I'm wondering what tools/strategies have you used in the past to resolve them? I am using .NET Memory Profiler and I've found that one of my huge main objects is staying in memory after I close ...

Garbage Collection in C++ -- why?

I keep hearing people complaining that C++ doesn't have garbage collection. I also hear that the C++ Standards Committee is looking at adding it to the language. I'm afraid I just don't see the point to it... using RAII with smart pointers eliminates the need for it, right? My only experience with garbage collection was on a couple of c...

Best Practice for Forcing Garbage Collection in C#

In my experience it seems that most people will tell you that it is unwise to force a garbage collection but in some cases where you are working with large objects that don't always get collected in the 0 generation but where memory is an issue, is it ok to force the collect? Is there a best practice out there for doing so? ...

Manual vs. Automatic Memory Management

Do you prefer malloc and free / new, delete, etc... or do you prefer your language to have garbage collection? Why and why not? Do you have any proof besides your own reasoning about why your method is better? ...

Can garbage collection coexist with explicit memory management?

For example, say one was to include a 'delete' keyword in C# 4. Would it be possible to guarantee that you'd never have wild pointers, but still be able to rely on the garbage collecter, due to the reference-based system? The only way I could see it possibly happening is if instead of references to memory locations, a reference would be...

Self-owned objects in Objective-C Garbage Collection

I'm wondering what are the recommended ways to handle situations where, in memory managed code, object didn't belong to any particular owner, i.e. objects released themselves. One such example could be a subclass of NSWindowController, which configures, displays and manages input and output of a single window. The controller object displ...

When will my BackgroundWorker instance be garbage collected

consider this code block public void ManageInstalledComponentsUpdate() { IUpdateView view = new UpdaterForm(); BackgroundWorker worker = new BackgroundWorker(); Update update = new Update(); worker.WorkerReportsProgress = true; worker.WorkerSupportsCancellation = true; ...

When should I dispose my objects in .NET?

For general code, do I really need to dispose an object? Can I just ignore it for the most part or is it a good idea to always dispose an object when your 100% sure you don't need it anymroe? ...

How to unit test IDisposable?

I'm working on a piece of library code around IDisposable. The managed path (via using) is easily testable. I'm wondering about the finalizer though: Is calling System.GC.Collect() sufficient to force the finalizer to run? ...

How can I experiment with garbage collection?

I'm interested in how garbage collection works. I've read up on how some work such as mark-and-sweep, stop-and-copy, generational GC, etc... I'd like to experiment with implementing some of these and comparing their behaviors. What's a good way to get started experimenting with my own? Ideally something in C, Java or Python (although the...

Create a weak reference to an object

Is it possible in Actionscript 3 to create a weak reference to an object, so that it can be garbage collected. I'm creating some classes to make debugging easier, so I don't want the objects to hang around in memory if they are only referenced here (and of course I don't want to fill the code with callbacks to remove the objects) ...