Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4061708
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:30:14+00:00 2026-05-20T15:30:14+00:00

I am using SOS debug extension dll to check the memory layout of a

  • 0

I am using SOS debug extension dll to check the memory layout of a String type, and below is the result.

!dso

ESP/REG  Object   Name

0015EFC0 01c6b9cc System.String    hello,world

!do 01c6b9cc

Name:        System.String

MethodTable: 6de3f9ac

EEClass:     6db78bb0

Size:        36(0x24) bytes

File:        C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089>\mscorlib.dll

String:      hello,world

Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name

6de42978  40000ed        4         System.Int32  1 instance       11 m_stringLength

6de41dc8  40000ee        8          System.Char  1 instance       68 m_firstChar

6de3f9ac  40000ef        8        System.String  0   shared   static Empty

    >> Domain:Value  00331488:01c61228 <<

Now I am wondering, where exactly is the string value “hello world” stored?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T15:30:14+00:00Added an answer on May 20, 2026 at 3:30 pm

    At m_firstChar. The heap allocation is large enough to fit the entire string, not just the first character. Easy to see in Visual Studio as well:

    class Program {
        static void Main(string[] args) {
            string s = "hello" + "world";
        }  // <=== Breakpoint here
    }
    

    When the breakpoint hits, use Debug + Windows + Memory + Memory1. In the Address box type s. You’ll see:

    0x01B3F6BC  e8 0a 67 6e 0b 00 00 00 0a 00 00 00 68 00 65 00  è.gn........h.e.
    0x01B3F6CC  6c 00 6c 00 6f 00 77 00 6f 00 72 00 6c 00 64 00  l.l.o.w.o.r.l.d.
    
    • The object starts at the address – 4, the syncblk is stored there (not visible).
    • Next 4 bytes is the method table pointer (0x6e670ae8, aka type handle).
    • Next 4 bytes is the m_arrayLength member, the allocated size of the string (0x0b).
    • Next 4 bytes is the m_stringLength member, the actual number of characters in the string (0x0a).
    • Next bytes store the string, starting at m_firstChar.

    This is for .NET 3.5 SP1. You won’t see the m_arrayLength member in .NET 4.0 and up, the field was removed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From within visual studio immediate window with SOS debugging extension loaded I can do
MyManagedFunc in managed.exe calls into MyUnmanagedFunc() in unmanaged.dll. I produce a minidump in unmanaged.dll
Using strings in C++ development is always a bit more complicated than in languages
Is there any way to tell SOS to merge all the latest files in
Title kinda says it all. The usual SOS command !bpmd doesn't do a lot
I am trying to write something in c++ with an architecture like: App -->
I recently followed a discussion on the Qt4-interest mailing list about whether it is
I have a managed code Windows Service application that is crashing occasionally in production
While my .Net 3.5 app was running, the Windows Task Manager shown that my
I am sorry if the post is too long, but I would be happy

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.