• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Is this a bug, or am I hacking?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this a bug, or am I hacking?


  • Subject: Re: Is this a bug, or am I hacking?
  • From: Allison Newman <email@hidden>
  • Date: Thu, 14 Aug 2008 21:21:17 +0200

Hi Graham,

Generally speaking, string constants are only optimised within statically linked binaries. Dynamically linked libraries, such as dll's, so's and Mac bundles will not share constants.

Basically, under the hood, when you link together all of your object files at build time, the linker eliminates duplicate constants to save on memory. Obviously, with dynamically linked code, you cannot know at link time whether or not a constant is going to be duplicated in another code module that will be linked at runtime, so the constant has to be included in the binary. And as it has to be included in the binary anyhow, there is no benefit to be had in removing it at runtime, and forcing all of the addresses in the binary to be recalculated.

Net result, the same constant will be duplicated in two different binary files that are linked dynamically, and hence pointers to those constants will have different values in the two different binaries.

Hope that helps.

Alli
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Is this a bug, or am I hacking?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Why does Core Data retain an object when one of that object's attributes is changed?
  • Next by Date: Re: Why does Core Data retain an object when one of that object's attributes is changed?
  • Previous by thread: Re: Is this a bug, or am I hacking?
  • Next by thread: Re: Is this a bug, or am I hacking?
  • Index(es):
    • Date
    • Thread