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

  • Home
  • SEARCH
  • 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 174363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:30:30+00:00 2026-05-11T13:30:30+00:00

As far as I know, strings are immutable in Delphi. I kind of understand

  • 0

As far as I know, strings are immutable in Delphi. I kind of understand that means if you do:

string1 := 'Hello'; string1 := string1 + ' World'; 

first string is destroyed and you get a reference to a new string ‘Hello World’.

But what happens if you have the same string in different places around your code?

I have a string hash assigned for identifying several variables, so for example a ‘change’ is identified by a hash value of the properties of that change. That way it’s easy for me to check to ‘changes’ for equality.

Now, each hash is computed separately (not all the properties are taken into account so that to separate instances can be equal even if they differ on some values).

The question is, how does Delphi handles those strings? If I compute to separate hashes to the same 10 byte length string, what do I get? Two memory blocks of 10 bytes or two references to the same memory block?

Clarification: A change is composed by some properties read from the database and is generated by an individual thread. The TChange class has a GetHash method that computes a hash based on some of the values (but not all) resulting on a string. Now, other threads receive the Change and have to compare it to previously processed changes so that they don’t process the same (logical) change. Hence the hash and, as they have separate instances, two different strings are computed. I’m trying to determine if it’d be a real improvement to change from string to something like a 128 bit hash or it’ll be just wasting my time.

Edit: Version of Delphi is Delphi 7.0

  • 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. 2026-05-11T13:30:31+00:00Added an answer on May 11, 2026 at 1:30 pm

    Delphi strings are copy on write. If you modify a string (without using pointer tricks or similar techniques to fool the compiler), no other references to the same string will be affected.

    Delphi strings are not interned. If you create the same string from two separate sections of code, they will not share the same backing store – the same data will be stored twice.

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

Sidebar

Ask A Question

Stats

  • Questions 79k
  • Answers 79k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm not sure I follow. If you've bound the Background… May 11, 2026 at 4:11 pm
  • Editorial Team
    Editorial Team added an answer The exact syntax you want is not possible in JavaScript.… May 11, 2026 at 4:11 pm
  • Editorial Team
    Editorial Team added an answer I haven't used this but boost's filtering_stream may help. As… May 11, 2026 at 4:11 pm

Related Questions

In a C# application I am working on I have a very long identifier
I am looking for a method to compare and sort UTF-8 strings in C++
I'm currently studying this tutorial : and I understand completely how to rotate/scale/translate each
I already managed to split the CSV file using this regex: /,(?=(?:[^\] \[^\] \)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.