Re: How does managed code work?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




Some good questions, I will answer a few:

Siegfried Heintze wrote:


(2) Can someone point me to a discussion of the managed heap?

Simply a heap for managed objects. The real issue is the Garbage collector.


(3) Why do we have non-determanistic destructors in C#?

The only possibility with a GC. But well written code will always use the explicit (deterministic) approach, and the GC/finalizer method is a safety net for situations that would be a resource-leak in an unmanaged language. The whole non-deterministic issue turns out to be largely theoretical.

A few points in favor of GC:
- automatic cleanup of all non-resource holding objects
- effective sharing of objects makes for much better OOP
- compacting means better use of Processor cache


(5) How is the structure of a managed DLL different from a native DLL?

It is strong-named and .NET allows side-by-side (different versions loaded at the same time).


(8) What is the difference between using PInvoke to manipulate a semephore or mutex and using System.Threading?

Most objects in System.Threading are wrapped Win32 semaphores (the P/Invoke already done). But Monitor is native .NET

-HH-
.