miercuri, 25 noiembrie 2009

[.NET] Memory management

Memory impacts on:
- performance (memory leaks, RAM Footprint)
- stability (temporary objects, memory leaks)
- scalability (RAM Footprint)
- other applications - sluggish performance (RAM Footprint, temporary objects)

.NET automatically manages the memory (creates objects onto managed memory heap, destroys object that are no more in use).
Object allocated when you use new.

Types of memory used by .NET:
- Stack:
  • local variables, method parameters, return values, and other temporary values are stored
  • is allocated on a per-thread basis
  • GC is not responsible for cleaning up the stack / GC is aware of references to objects stored on the stack.
- Unmanaged Heap
  • is used for runtime data structures, method tables, Microsoft intermediate language (MSIL), JITed code, and so forth
  • Managed code can allocate unmanaged heap memory directly by calling into unmanaged Win32® APIs or by instantiating COM objects.
- Managed Heap
  • is where managed objects are allocated and it is the domain of the garbage collector.
2 types of managed heaps:
- small object heap (SOH)
- large object heap (LOH)

Memory Management: Algorithms and Implementations in C/C++ (Windows Programming/Development)

Niciun comentariu:

Trimiteți un comentariu