30.06.2013 Views

Under the Hood of .NET Memory Management - Simple Talk

Under the Hood of .NET Memory Management - Simple Talk

Under the Hood of .NET Memory Management - Simple Talk

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2: The <strong>Simple</strong> Heap Model<br />

Consider <strong>the</strong> following code:<br />

class MyClass<br />

{<br />

string Test="Hello world Wazzup!";<br />

byte[] data=new byte[86000];<br />

}<br />

Listing 2.1: Allocating MyClass.<br />

It's easy to assume that <strong>the</strong> size <strong>of</strong> MyClass when allocated includes:<br />

• 19 characters<br />

• 86,000 bytes.<br />

Figure 2.1: Heap allocation locations.<br />

37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!