Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Managed code is code that runs under the CLR (Common Language Runtime). CLR is kinda like a Virtual Machine that allows all languages to have common types and objects. All .NET languages that are written using managed code run under the CLR they compile to MSIL (Microsoft Intermediate Language) which looks a lot like assembly.
Unmanaged code is code that does not run under the CLR. This could be C++ or C# that is using the UNSAFE directive.
Hope this helps some,
ChiThey mostly come at night...mostly.

hmm! chi no this is not what i am looking for.
i read that managed code is that whoes memory management is done by CLR. right so that is called Managed code... while other is not....
any further difference ??

The CLR is just a runtime with machine-like interfaces (as stated, a virtual machine). Managed code is an advanced form of memory-managed. Traditional management is based on allocation and deallocation, sometimes with garbage collection thrown in (which of course the CLR has). We could end the definition here, but that would not really tell us what is functionally happening.
The CLR (and any virtual machine - check out LISP) can deconstruct code, analyze it in pieces, and then reconstruct it with performance, security, and system-specific considerations. This partly accomplished through JIT compiling and party through a sophisticated object system. The overall effect is that there is greater 1) code reuse, 2)security considerations can be verified pre-execution, 3)optimizations can be centralized at the system level, and 4) programming languages and libraries become interfaces.
Some other benefits:
- Memory management is the easiest place for a programmer to introduce bugs into the program. It is basically a fact that all programs have bugs, so if we can eliminate or mediate a major problem domain, that's a good thing. This is a step towards true software engineering, in my opinion (and better code reuse).
- Security now takes a step towards a true policy-focus. That is, we can make general statements about what all programs (in our CLR) can and cannot do. This includes checks for possible problems or simply permissions mechanisms pertaining to what certain system components can and cannot do (not user-level priveleges - I mean an internal privelege structure). Now the concept of trusted code can take on a level granularity in regards to individual objects or functions and abstract components of a system. One change of policy that all parts of the system implicitly know at runtime. Sysadmins, for example, could know that the programs running obey the policies they have enforced in a central policy component. I am not aware this sort of setup is really out there (you could certainly do it yourself), but I suspect Microsoft will be the first to establish it.

anonproxy! a beautiful explaination...that helps alot..can you please proivde me some ref. for further reading.

The sarcastic answer to your request is to say "go build your own crippled version of lisp." (There's this running half-joke that languages - VM-based ones in particular - are simply trying to recreate LISP, but they always screw it up. So the joke goes, this is the only way most people learn about LISP - from failing to recreate it. There's double irony in telling someone to go do this anyway. Hackers have very complex humor.)
Seriously though, memory management is a big issue. Typically it is talked about in the context of a particular program, problem domain, or set of algorithms. So you need to work on summarizing lots of material if you want to get anywhere.
Somethings you can look at:
- MSDN article on the CLR (1.x). The details are not too important, but notice how the code is deconstructed and analyzed. Look for what extends traditional compilation. This is the only reason I ever read MSDN. Also check out this article on CLR memory management.
- Read a PDF about IBM's JIT implementation. (File is almost 1MB). Look for similarities between this and a static compiler. IBM is a great resource for free technical writing, incidentally (journals and developer works). It's all free.
- For a memory management glossary, visit The MemoryManagement website. Just browsing the glossary is educational. This may sound crazy, but I get so many ideas from simply glossing over things like this. Think of it as a free service - someone has taken the time to sort important concepts for you into small pieces. If something interests you, Google tells all.

yep! it really does. thanks for sharing this all. it really gives some good clues for the station :)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |