Click here to Skip to main content
15,914,163 members
Home / Discussions / C#
   

C#

 
AnswerRe: Should I implement IDisposable? Pin
Scott Dorman26-May-08 7:47
professionalScott Dorman26-May-08 7:47 
GeneralRe: Should I implement IDisposable? Pin
DaveyM6926-May-08 7:59
professionalDaveyM6926-May-08 7:59 
GeneralRe: Should I implement IDisposable? Pin
Guffa26-May-08 11:37
Guffa26-May-08 11:37 
GeneralRe: Should I implement IDisposable? Pin
Scott Dorman26-May-08 15:00
professionalScott Dorman26-May-08 15:00 
GeneralRe: Should I implement IDisposable? Pin
S. Senthil Kumar26-May-08 20:57
S. Senthil Kumar26-May-08 20:57 
GeneralRe: Should I implement IDisposable? Pin
Scott Dorman27-May-08 1:28
professionalScott Dorman27-May-08 1:28 
GeneralRe: Should I implement IDisposable? Pin
Guffa26-May-08 21:30
Guffa26-May-08 21:30 
GeneralRe: Should I implement IDisposable? Pin
Scott Dorman27-May-08 1:24
professionalScott Dorman27-May-08 1:24 
Guffa wrote:
Do you have any documentation to back that up?


Take a look at this article from Joe Duffy: http://www.bluebytesoftware.com/blog/PermaLink,guid,88e62cdf-5919-4ac7-bc33-20c06ae539ae.aspx[^]

Consider nulling out large managed object fields in your Dispose method. This is seldom necessary, but should be considered when a field is expensive to keep around, yet its owning object might be held on to longer than necessary. Simply because Dispose was called does not mean that its reference is being released. This could happen, for example, if its container (the object being disposed) is referred to from within a long-running scope (or stored in a static variable), and not explicitly nulled out. Doing this could help to reduce the lifetime of the object by making it eligible for garbage collection sooner. The definition of large and expensive is of course subjective and should be based on performance profiling and measurement.
There were also a set of MSDN articles by Jeff Richter, but those appear to have been removed from the MSDN website...still looking around for other copies.

Also, take a look at this article, and specifically the comments from Wesner: http://weblogs.asp.net/pwilson/archive/2004/02/20/77422.aspx[^]

Or the second paragraph here[^]

Guffa wrote:
AFAIK, it doesn't matter att all where the objects are allocated. The garbage collector only looks at the active references. If an inactive reference points to an object on the large objects heap, that doesn't turn it into an active reference.


It does matter where objects are allocated since objects in the LOB are still collected but the LOB itself is not compacted like the regular heap. I never said that "If an inactive reference points to an object on the large objects heap" it turns it into an active reference. What I did say was that you should set the large object to null, not necessarily anything that points to it.

Scott.

—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

[Forum Guidelines] [Articles] [Blog]

GeneralRe: Should I implement IDisposable? Pin
Guffa27-May-08 2:21
Guffa27-May-08 2:21 
GeneralRe: Should I implement IDisposable? Pin
DaveyM6927-May-08 11:53
professionalDaveyM6927-May-08 11:53 
GeneralRe: Should I implement IDisposable? Pin
Scott Dorman27-May-08 16:14
professionalScott Dorman27-May-08 16:14 
GeneralRe: Should I implement IDisposable? Pin
DaveyM6928-May-08 1:19
professionalDaveyM6928-May-08 1:19 
GeneralRe: Should I implement IDisposable? Pin
Scott Dorman27-May-08 16:03
professionalScott Dorman27-May-08 16:03 
GeneralRe: Should I implement IDisposable? Pin
Guffa27-May-08 21:19
Guffa27-May-08 21:19 
AnswerRe: Should I implement IDisposable? Pin
Guffa26-May-08 11:29
Guffa26-May-08 11:29 
GeneralRe: Should I implement IDisposable? Pin
DaveyM6927-May-08 1:19
professionalDaveyM6927-May-08 1:19 
QuestionPinned form Pin
netJP12L26-May-08 6:25
netJP12L26-May-08 6:25 
AnswerRe: Pinned form Pin
DaveyM6926-May-08 7:19
professionalDaveyM6926-May-08 7:19 
GeneralRe: Pinned form Pin
netJP12L26-May-08 8:56
netJP12L26-May-08 8:56 
GeneralRe: Pinned form Pin
DaveyM6926-May-08 9:09
professionalDaveyM6926-May-08 9:09 
QuestionSelect statement To display each row as colum for Gridview control Pin
Member 400849226-May-08 6:00
Member 400849226-May-08 6:00 
AnswerRe: Select statement To display each row as colum for Gridview control Pin
Ashfield26-May-08 8:09
Ashfield26-May-08 8:09 
AnswerRe: Select statement To display each row as colum for Gridview control Pin
Atif Ali Bhatti26-May-08 8:16
Atif Ali Bhatti26-May-08 8:16 
QuestionEnable custom control to be editable or intreactive in Design Mode Pin
leeoze26-May-08 3:46
leeoze26-May-08 3:46 
AnswerRe: Enable custom control to be editable or intreactive in Design Mode Pin
leppie26-May-08 4:08
leppie26-May-08 4:08 

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.