CHAPTER 2

images

C# Objects in Memory

This chapter examines the C# object and the relation between it and the stack and heap of the memory. The life of the value type stays in the stack, whereas the reference type stays in the heap. I will explain about these using the windbg.exe program and discuss the different sections of the memory while the CLR executes any .NET application.

Finally, this chapter will discuss boxing and unboxing by examining the stack and heap memory while executing a program.

Memory in .NET Applications

In .NET, when an application is run, the CLR uses two kinds of memory—stack and heap—to store value types and reference types. ...

Get Expert C# 5.0: with the .NET 4.5 Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.