Storage of C # arrays in memory

Source: Internet
Author: User

C # Arrays are reference types, so how are they stored in memory?

Debug C # programs in VS, how to view memory, registers, disassembly in this article see how to view memory in VS

First breakpoint hit after the array creation statement there, point Debug->windows->memory, choose a random Memory

In the Immediate window, enter the & variable name arr to get the memory address of arr.

&arr
0X009BECD8-----> referencing addresses in the stack
*&ARR:0X02D75CB4-----> Start Address of space in the managed heap

After these days of fast food knowledge learning, know that the stack is filled with high-low padding. In the managed heap, it seems that the opposite is not certain, because garbage is recycled as part of the compression of objects that are referenced.

See Memory Ha ~ C8 3b B8 72 09 What I don ' t know, if you know, let me know.

INT 32, the normal value type is a struct.

There's also a trick, recently learned, vs inside automatically generate constructors, enter ctor, then point Ctrl+r+e

There is also a trick to automatically generate Get,set. private int _name, then click Tab

String and object are the only predefined two reference types.

16 Storage in memory 00 00 00 10

15 Storage in Memory 0F

Suddenly wanted to reflect arr[0]. The Range GetType () int32 represents is

An integer of plus or minus 2 of the 31-time Square. Is there a sign that indicates a bit? I guess.

http://blog.csdn.net/zxsydyq/article/details/9125641 C # int16 Int32 int64 difference long is not true long,.net Framework type is int64 Short is not real, the. NET Framework type is Int16

Storage of C # arrays in memory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.