Hi,code anyone could tell me what is the difference between these two I know that the C# compiler makes a managed code and C and C++ compilers make unmanaged codes but what is the exact difference?

Briefly…

Managed code compiles to Intermediate Language (IL) instead of direct to machine code. This code runs in the Common Language Runtime which converts the code to machine code and provides services such as security, threading and memory management etc.

Unmanaged code compiles direct to machine code. Services such as memory management and security are managed by the operating system.


So code written in .net is compiled twice:

.NET > MSIL > Machine Code

hi,thanks.

you know my problem is I want to get details to memory management and usage of stack and heap memory in unmanaged codes and compare it with the managed code,any idea from were can I start?any web resources.

regards

Well for starters I believe you'll find hands down that managed code runs a higher overhead on system resources which is, in part, why it hasn't particularly 'taken off' in mainstream usage for software design* yet.

Coupled with the fact that (unless you force your memory management which defeats part of the purpose there) you have no control over exactly when a resource will be freed up it can cause some bulky memory loads in between disposals.

As for actual benchmarks, not really sure where to look per-se but I hope this helps put it in a bit better perspective.

Edit: * Let me qualify more specifically, C# (aka managed code) has become a widely used standard in ASP.Net based web applications but has not become a mainstream reality in desktop applications as of yet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.