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 ...
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 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 ...
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...
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.
...
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...
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?
...
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...
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?
...
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(...
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...
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...
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 ...
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...
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 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...
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?
...
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 #(...
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
...
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...