finalizer Questions

4

Solved

What is best answer on interview on such question you think? I think I didn't find a copy of this here, if there is one please link it.
Hulk asked 26/11, 2011 at 3:25

2

Solved

I have test code like this: public class A : CriticalFinalizerObject { ~A() { File.WriteAllText("c:\\1.txt", "1z1z1"); } } class Program { static void Main(string[] args) { A a = new A();...
Pollux asked 18/5, 2012 at 16:9

4

Solved

Possible Duplicate: Why would you ever implement finalize()? I saw some java files with the following code: public void finalize() { if (conn != null) { try { conn.close(); } cat...
Galloromance asked 13/5, 2012 at 20:5

6

Solved

As always, a lengthy problem description. We are currently stress testing our product - and we now we face a strange problem. After one to two hours, heap space begins to grow, the application die...
Cristalcristate asked 3/5, 2012 at 17:8

3

Solved

I'm about to implement a managed wrapper class around an OpenGL texture and I want the object finalizer to call glDeleteTextures. So, the thread calling the finalizer (GC thread?) must be bound to...
Goodygoody asked 23/4, 2012 at 14:37

1

Solved

I'm not 100% clear on how an instance of class A can be defined to exist until after the last instance of class B is finalized. Or in other words, I'd like all B's to call close&dispose method...
Primeval asked 15/4, 2012 at 17:27

3

Solved

class Program : CriticalFinalizerObject { static void Main(string[] args) { Program p = new Program(); TextWriterTraceListener listener = new TextWriterTraceListener(@"C:\trace.txt"); Trace...
Piacular asked 6/4, 2012 at 13:16

1

Is a finalizable object with GC.SuppressFinalize the same as a normal unfinalizable object? The code below seems to prove they're treated differently, both on .NET 2 and 4: class Class1 { public...
Millinery asked 28/3, 2012 at 17:48

2

Solved

I have this code: Essentially i'm trying to demonstrate the use of the c# finalizer and make an object that cannot die, I called it Zombie. Now, normally this demo works great, but today I tried u...
Kook asked 17/3, 2012 at 20:3

3

Solved

What would happen if an exception is thrown during the execution of finalize()? Is the stack unwind like normally? Does it continue finalize() and ignore the exception? Does it stop finalize() and ...
Chiefly asked 14/6, 2010 at 14:51

6

Solved

I'm reading through a C# topic on Dispose() and ~finalize and when to use which. The author argues that you should not use references within your ~finalize because it's possible the object you're r...
Rosol asked 28/2, 2012 at 21:33

3

Solved

An interviewer asked me that How can you implement a class Foo, where you will be able to count instances of that class. There are more threads which are creating instance of that class Foo. ...
Terzetto asked 27/12, 2011 at 7:3

3

Solved

When seeing about the whole finalizer/IDisposable issue, it is usual to see that, at the end, after all the long description, there will be something to the meaning of "LOL what I said was actually...
Gloam asked 13/11, 2011 at 8:50

4

Solved

Whilst 'investigating' finalisation (read: trying stupid things) I stumbled across some unexpected behaviour (to me at least). I would have expected the Finalise method to not be called, whereas ...
Landman asked 4/11, 2011 at 14:44

1

Solved

I have an application that experiences a slow memory leak from the word go. Using ANTS Memory Profiler I can see that all of the leaked memory is being held by the finalizer queue's GC root. I s...
Basket asked 9/10, 2011 at 16:14

1

How does a "finalizer guardian" [Effective Java , page 30] work ? Have you used them? Did it solve any specific problem ?
Pilferage asked 29/7, 2011 at 12:9

3

Solved

Finalizers are always called by .net framework, so the sequence could be out of control; and even if the constructor failed, the destructor still can be triggered. This could bring troubles, when ...
Isom asked 18/7, 2011 at 1:50

7

Solved

From what I can tell, it is an accepted rule that if you have a class A that has a member m that is IDisposable, A should implement IDisposable and it should call m.Dispose() inside of it. I can't...
Knout asked 23/5, 2011 at 18:47

2

Solved

I'm having trouble with a misbehaved library that throws an exception in a finalizer, which of course crashes the application. To avoid this, I tried loading the library in its own AppDomain, but ...
Vitus asked 11/10, 2010 at 12:44

6

Solved

As I understand there are two camps concerning this question - the first one thinks that finalizer is a destructor specific to C#. So they think that these two things are the same. The second camp...
Pino asked 4/5, 2011 at 11:37

4

Solved

In C#, as mentioned in the Documentation, and this nice post's accepted answer, it's stated that classes don't inherit the Destructor of their parent class. The question : If I want to make sure ...
Profane asked 20/4, 2011 at 14:48

1

Solved

I've looked at the various questions that mention this specific exception (this question lists many of them, which I've visited). Also, I have the same general question as this post, but in a diffe...
Otten asked 14/3, 2011 at 18:45

5

Solved

I was reading this article the other day and was wondering why there was a Finalizer along with the Dispose method. I read here on SO as to why you might want to add Dispose to the Finalizer. My cu...
Columbous asked 10/9, 2009 at 11:35

3

Solved

In answering another question* on SO, and the subsequent comment discussion, I ran into a wall on a point that I'm not clear on. Correct me on any point where I'm astray... When the Garbage Colle...
Civism asked 7/3, 2011 at 18:0

8

Solved

I'm trying to make sure that my understanding of IDisposable is correct and there's something I'm still not quite sure on. IDisposable seems to serve two purpose. To provide a convention to "shu...
Donau asked 18/6, 2009 at 15:15

© 2022 - 2024 — McMap. All rights reserved.