Click here to Skip to main content
14,923,504 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 14:28
mvahoney the codewitch14-May-19 14:28 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 15:31
MemberSuper Lloyd14-May-19 15:31 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 16:16
mvahoney the codewitch14-May-19 16:16 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 16:44
MemberSuper Lloyd14-May-19 16:44 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 16:48
mvahoney the codewitch14-May-19 16:48 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 17:13
MemberSuper Lloyd14-May-19 17:13 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 17:17
mvahoney the codewitch14-May-19 17:17 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 17:24
mvahoney the codewitch14-May-19 17:24 
Let be me more explicit here.

A) You cannot leak HGLOBAL outside of a process. Any process allocated resource will be freed on process exit, managed or not.

B) Finalized objects are placed in a special list, and generally their finalizers get called right before proc exit.

Since A, B is redundant. Meaning the code is redundant.

I don't leak. And I don't use finalize.

But I do dispose.

The exception is maybe RPC, but worst I'd maybe do this

#if DEBUG
void Finalize() {if(!_isDisposed) {System.Diagnostics.Debug.WriteLine("Error: Object not disposed"); System.Diagnostics.Debugger.Break();} }
#endif DEBUG

so you could catch it in a debug session.

I don't believe in using that set aside list - it adds unnecessary churn to the GC.

I'd rather report the failure, because if you're not disposing you're also running into other problems finalize won't help you with - like stepping on unclosed files or worse, running out of GDI handles. Before finalize ever gets a chance to be called.

At any rate, I don't use unmanaged resources directly on serious projects, so you won't find it an issue in my code.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.


modified 14-May-19 23:29pm.

GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 17:30
MemberSuper Lloyd14-May-19 17:30 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 17:38
mvahoney the codewitch14-May-19 17:38 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 18:16
MemberSuper Lloyd14-May-19 18:16 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:30
mvahoney the codewitch14-May-19 18:30 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:32
mvahoney the codewitch14-May-19 18:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 18:40
MemberSuper Lloyd14-May-19 18:40 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 18:43
mvahoney the codewitch14-May-19 18:43 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 18:55
MemberSuper Lloyd14-May-19 18:55 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:03
mvahoney the codewitch14-May-19 19:03 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:11
MemberSuper Lloyd14-May-19 19:11 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:32
mvahoney the codewitch14-May-19 19:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:37
MemberSuper Lloyd14-May-19 19:37 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:56
mvahoney the codewitch14-May-19 19:56 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 20:32
MemberSuper Lloyd14-May-19 20:32 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch15-May-19 3:38
mvahoney the codewitch15-May-19 3:38 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
Super Lloyd14-May-19 19:12
MemberSuper Lloyd14-May-19 19:12 
GeneralRe: Some thoughts on the .net CLR/CLI Pin
honey the codewitch14-May-19 19:29
mvahoney the codewitch14-May-19 19:29 

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.