garbage-collection

Finalizer and IDisposable

Based on the documentation (MSDN: link), it is clear that one should use the IDisposable pattern when implementing a finalizer. But do you need to implement a finalizer if you implement IDisposable (so as to provide a deterministic way of disposing the object), and you dont have any unmanaged resources to clean up? As I see it, if the ...

What are the possible ways to do garbage collection in concurrent systems?

I need to write a garbage collector for an interpreter that will support concurrency, but I can only find information about garbage collection without anything to do with concurrency. Are there specific methods for garbage collection of objects in multithreaded systems? Where can I find information on their architecture and implementati...

A question about static members inside non-static classes and garbage collection

A collegue of mine claims that in C# having static members in non-static classes prevents instances of those classes from ever being garbage collected and that this is a common source of C# memory leaks. As a result he always wraps static members in a static class and gains access to them from there via a static property or method(s) on ...

Garbage Collector and Core Graphics

Hi, I'm writing a create CGImageRef from a Path method. This is: - (CGImageRef)createImage:(NSString*)path { // Create NSURL NSURL *url = [NSURL fileURLWithPath:path]; CFURLRef cfURL = (CFURLRef)url; // Create image from source CGImageRef image = NULL; CGImageSourceRef imageSource = NULL; imageSource = CGIm...

How to prevent or minimize the negative effects of .NET GC in a real time app?

Are there any tips, tricks and techniques to prevent or minimize slowdowns or temporary freeze of an app because of the .NET GC? Maybe something along the lines of: Try to use structs if you can, unless the data is too large or will be mostly used inside other classes, etc. ...

Fixing GC error in Mac Common Lisp 5.0

Hi all, I'm fairly new to Lisp, and I'm trying to run an algorithmic music application on the original MCL 5.0 (not the RMCL version). The program works by incrementally inputting textual representations of music, and learning from the user via an association net. Unfortunately, shortly after I begin inputting the text, I begin to see t...

C#: should object variables be assigned to null?

In C#, is it necessary to assign an object variable to null if you have finished using it, even when it will go out of scope anyway? ...

Python garbage collection can be that slow?

Hi, I have a problem with my python application, and I think it's related to the python garbage collection, even if I'm not sure... The problem is that my application takes a lot of time to exit and to switch to one function to the next one. In my application I handle very large dictionaries, containing thousands of large objects whic...

Does tuning the GC help?

Possible Duplicate: Has anyone found Garbage Collection tuning to be useful? Does it really help? Isn't the jvm written by much smarter people? What will be case to tune it manually? ...

Garbage collection inside a lock object

Putting peoples opinions about garbage collection aside are there any deadlocking issues with the following: private static readonly object lockObj = new object(); lock(lockObj ) { ///Load objects into a cache List<object> from DB call GC.Collect(2); GC.WaitForPendingFinalizers(); GC.Collect(...

InputStreams being GCed

I know that if I do something like copyFromInToOut(new FileInputStream(f1), new FileOutputStream(f2)); System.gc(); It will run the GC on those FileInputStreams, closing them. But if I do copyFromInToOut(new BufferedInputStream(new FileInputStream(f1)), new BufferedOutputStream(new FileOutputStream(f2)); System.gc(); Is there any...

garbage collection question for javascript

I have two piece of code sample 1 (function(){ var x = 1; this.getx = function() { return x; }; })(); sample 2 (function(){ var x = 1; this.getx = function() { }; })(); both code samples create a closure, x in sample one is referenced, while x in sample two is not referenced, I know x in sample one will not be garbage c...

Closure scope and garbage collection

I've just written some code to perform a timeout action if an asynchronous task takes too long to process, but what is not clear to me is if and when the timeout instance will ever be disposed of (I think it will in the case where the asynchronous task completes in a timely fashion, but otherwise I've got no idea), or if I'm going to be ...

What is the .NET equivalent of java's -verbose:gc command line option

I'm writting an ASP.NET MVC application and I'm seeing a seemly random performance from a one of my actions. My initial throught is that the garbage collection is kicking in and pausing the app for a little while, but I can't seem to find a button/switch that will prove or disprove my theory. For none java people out there -verbose:gc i...

Singletons and ASP.NET MVC

Right now I'm having an issue with a Singleton that I just wrote for use in ASP.NET MVC -- My Singleton looks like this: public sealed class RequestGenerator : IRequestGenerator { // Singleton pattern private RequestGenerator() { requestList = new Stack<Request>(); appSettings = new WebAppSettings(); } ...

With recent Sun JVMs (1.6), is it possible to get GC thread information?

With JRockit, you can get the full list of threads by any means, and all of these means include information about the Garbage Collection Thread(s): 1) Asking the Thread class for the information: Thread.getAllStackTraces(); 2) Using ThreadGroup to get that information: ThreadGroup root = Thread.currentThread().getThreadGroup(); whil...

Garbage collection in flash

cam = Camera.getCamera(0); vid1.attachCamera(cam); cam = Camera.getCamera(1); vid1.attachCamera(cam); At the time when Camera.getCamera(1) is attached to vid1, is Camera.getCamera(0) destroyed internally or still in memory? How to verify that? ...

Clojure: gc overhead limit exceeded, lazy evaluation, pi sequence

For the next code: (ns clojure101.series) (defn avg [[x y]] (/ (+ x y) 2)) (defn avg-damp [seq] (map avg (partition 2 seq))) (defn avg-damp-n [n] (apply comp (repeat n avg-damp))) (defn sums [seq] (reductions + seq)) (defn Gregory-Leibniz-n [n] (/ (Math/pow -1 n) (inc (* 2 n)))) (def Gregory-Leibniz-pi (map #(...

Clean Up Vs Memory Reclaim in .Net

I was reading this MSDN reference: Although the garbage collector is able to track the lifetime of an object that encapsulates an unmanaged resource, it does not have specific knowledge about how to clean up the resource. For these types of objects, the .NET Framework provides the Object.Finalize method, which allows ...

When are Scala objects garbage collected?

This question is about Scala objects, which are defined something like this: object Pipeline { val dispatcher = new Dispatcher } I know that, in some circumstances, they are referred to as 'companion' objects, although I don't yet understand the distinction. Anyway, I want to know when they get garbage collected. So, in the above e...