none
How memory is allocated for string variable RRS feed

  • Question

  • the moment we declare variable like string s=""; then memory is allocated for string ? when later assign something like 

    s="blah blah blah blah blah "; then dynamically more memory is allocated for string ?

    Monday, April 8, 2019 8:06 PM

Answers

  • Hello,

    This is not a simple answer, see the following article.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by Sudip_inn Tuesday, April 9, 2019 7:28 PM
    Monday, April 8, 2019 8:23 PM
    Moderator
  • Hi Studip_inn,

    Thank you for posting here.

    For your question, you could refer to the link below.

    https://blog.maartenballiauw.be/post/2016/11/15/exploring-memory-allocation-and-strings.html

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Sudip_inn Tuesday, April 9, 2019 7:28 PM
    Tuesday, April 9, 2019 6:39 AM
    Moderator

All replies

  • Hello,

    This is not a simple answer, see the following article.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by Sudip_inn Tuesday, April 9, 2019 7:28 PM
    Monday, April 8, 2019 8:23 PM
    Moderator
  • Hi Studip_inn,

    Thank you for posting here.

    For your question, you could refer to the link below.

    https://blog.maartenballiauw.be/post/2016/11/15/exploring-memory-allocation-and-strings.html

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Sudip_inn Tuesday, April 9, 2019 7:28 PM
    Tuesday, April 9, 2019 6:39 AM
    Moderator