Interviews - C# Corner

Mallika
what is the difference between managed code and non managed code?
By Mallika in ASP.NET onSep 07 2010
  • Maggi
    Oct, 2010 1

    Mike Gold has already answered the question.I would like to add a point to it.

    Code that is executed by CLR is the managed code whereas the code that is not executed by CLR is the unmanaged code.
    Whereas we can have both managed and unmanaged code in C#. Pointers fall under the category of unmanaged code.

    • 0
  • Mike Gold
    Sep, 2010 8

    Managed code as stated runs behind the CLR (Common Language Runtime).  The code is called managed code because the objects created inside the application domain are "managed". In other words,  they are garbage collected when they fall out of scope or when they need to be collected by the CLR.  This means that the memory that the objects occupy is managed behind the seens.  When the object is created the memory is allocated.   When the object is garbage collected by the CLR, the memory is freed up.  Managed code frees the user up from having to deal with these issues. In unmanaged code, you need to do your own memory management when creating objects on the heap.   C#, F# and VB.NET are languages that run behind Managed Code.  IronPython and IronRuby do as well.  Visual C++ allows you to run in mixed mode with both managed and unmanaged code running in your application.

    also see http://en.wikipedia.org/wiki/Managed_code

    • 0
  • Koteswararao Mallisetti
    Sep, 2010 8

    managed code runs under the clr control where as unmanaged code runs as ordinary program os take care on that code

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS