Click here to Skip to main content
15,897,891 members
Home / Discussions / C#
   

C#

 
GeneralRe: Finalization and Performance Pin
George_George2-May-08 2:43
George_George2-May-08 2:43 
AnswerRe: Finalization and Performance PinPopular
Mike Dimmick1-May-08 6:04
Mike Dimmick1-May-08 6:04 
GeneralRe: Finalization and Performance Pin
N a v a n e e t h1-May-08 6:41
N a v a n e e t h1-May-08 6:41 
GeneralRe: Finalization and Performance Pin
Guffa1-May-08 9:29
Guffa1-May-08 9:29 
GeneralRe: Finalization and Performance Pin
George_George1-May-08 21:27
George_George1-May-08 21:27 
GeneralRe: Finalization and Performance Pin
N a v a n e e t h1-May-08 23:06
N a v a n e e t h1-May-08 23:06 
GeneralRe: Finalization and Performance Pin
George_George2-May-08 2:44
George_George2-May-08 2:44 
GeneralRe: Finalization and Performance Pin
Guffa2-May-08 1:54
Guffa2-May-08 1:54 
George_George wrote:
You mean when SuppressFinalize is called, the object is still put on the finalizer queue, but when finalizer thread runs and checked SuppressFinalize is called already, it will simply remove the object from the queue and reclaim its memory, right?


No, not quite. The effect is bascially the same, but that's not how it works.

I think that you are still confusing the finalizer queue with the freachable queue. The finaliser thread is not finalising object in the finalizer queue, it's finalising objects in the freachable queue.

All objects that have a Finalize method are placed in the finalizer queue when they are created. When the garbage collector finds an object to collect, it will check if it's in the finalizer queue. If it is, it will be placed in the freachable queue, and if it isn't, the memory can simply be reclaimed.

The SuppressFinalize method removes the object from the finalizer queue, so that it will not end up in the freachable queue.

Despite everything, the person most likely to be fooling you next is yourself.

GeneralRe: Finalization and Performance Pin
N a v a n e e t h2-May-08 2:35
N a v a n e e t h2-May-08 2:35 
GeneralRe: Finalization and Performance Pin
Guffa2-May-08 17:42
Guffa2-May-08 17:42 
GeneralRe: Finalization and Performance Pin
N a v a n e e t h2-May-08 20:35
N a v a n e e t h2-May-08 20:35 
GeneralRe: Finalization and Performance Pin
George_George2-May-08 2:47
George_George2-May-08 2:47 
GeneralRe: Finalization and Performance Pin
N a v a n e e t h1-May-08 23:08
N a v a n e e t h1-May-08 23:08 
GeneralRe: Finalization and Performance Pin
Guffa2-May-08 1:57
Guffa2-May-08 1:57 
GeneralRe: Finalization and Performance Pin
George_George1-May-08 21:28
George_George1-May-08 21:28 
GeneralRe: Finalization and Performance Pin
Pete O'Hanlon1-May-08 8:31
mvePete O'Hanlon1-May-08 8:31 
GeneralMagnificent Pin
Luc Pattyn1-May-08 9:11
sitebuilderLuc Pattyn1-May-08 9:11 
GeneralRe: Magnificent Pin
Spacix One1-May-08 9:49
Spacix One1-May-08 9:49 
GeneralRe: Magnificent Pin
Luc Pattyn1-May-08 10:20
sitebuilderLuc Pattyn1-May-08 10:20 
GeneralRe: Magnificent Pin
Big Daddy Farang1-May-08 10:55
Big Daddy Farang1-May-08 10:55 
GeneralRe: Magnificent Pin
Spacix One1-May-08 11:23
Spacix One1-May-08 11:23 
GeneralRe: Magnificent Pin
Luc Pattyn1-May-08 11:34
sitebuilderLuc Pattyn1-May-08 11:34 
GeneralRe: Magnificent Pin
Spacix One1-May-08 13:26
Spacix One1-May-08 13:26 
GeneralRe: Magnificent Pin
Luc Pattyn1-May-08 13:46
sitebuilderLuc Pattyn1-May-08 13:46 
GeneralRe: Magnificent Pin
George_George1-May-08 21:35
George_George1-May-08 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.