c# and FilterGetMessage (IFSD)

I think (hope!) that Tim is talking about managed C++ instead of C#.

Or perhaps a different usage scenario.

For sure the VS 2008 C# compiler doesn’t complain about software that never
calls gcnew or delete.

If Tim’s right in the context of C#, then I’ve written a lot of lines of
leaky code. :frowning:

Thomas F Divine
http://www.pcausa.com


From:
Sent: Monday, February 08, 2010 3:47 PM
To: “Windows System Software Devs Interest List”
Subject: RE:[ntdev] c# and FilterGetMessage (IFSD)

>
> Tim,
>
> Are you talking about C++ or C#?
> The reference which you provide is related to C++, where new is unmanaged
> by default . I could not find any reference to gcnew for C# in MSDN.
>
> Igor Sharovar
>
>
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

To end this thread. (Well, we can stop at least one source of noise…)…

In the context of a C# application:

Case 1:

BOZO _bozo;
bozo = new BOZO();

Case 2:

BOZO _bozo;
unsafe { bozo = new BOZO(); }

Case 1: No leak.
Case 2: No leak.

Thomas F. Divine
http://www.pcasua.com

>Yes, C++. I now begin to suspect that you and I have been having two entirely different conversations. >My apologies.

Yes, I mean C# because I discussed Thomas code below
*********************************************
Just to make sure I understand:
Case 1:
BOZO _bozo;
bozo = new BOZO();
Case 2: BOZO _bozo;
unsafe { bozo = new BOZO(); }

Case 1: No leak.
Case 2: Leaks. Use gcnew instead of new. Correct? If so, I have a leak and have learned something. Thomas
*********************************************
I believe that Thomas showed C# code because it contains “unsafe” key-word. And the discussion was about if it has a leak or not.
Despite on fact the discussion is not related to Windows device driver development I think it is useful because we’ve discussed communication from C# and drivers. Many Windows device driver development use C# GUI for developing at least for developing a test application.
Thanks for providing some information about using GC in C++ which I personally didn’t know before.

Igor Sharovar