• 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
Are C++ vtables shared or private memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Are C++ vtables shared or private memory?


  • Subject: Are C++ vtables shared or private memory?
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 10 Sep 2009 13:36:28 -0700

I'm working on reducing the memory usage of a large C++ app (the Chrome browser). Past experience has taught me that C++ vtables take up a surprising amount of space, and they're private data (not shared between processes, as code is.)

From poring over disassembly, I think I've established that GCC mangles vtables as symbols starting with "__ZTV". There are definitely a lot of symbols like this in the app, but 'nm -m' describes them all as:

027b2b20 (__DATA,__const_coal) non-external (was a private external) __ZTVN7WebCore16HTMLDListElementE
02772e80 (__DATA,__const) non-external (was a private external) __ZTVN7WebCore16HTMLEmbedElementE
...


Does "__DATA,__const" mean that the vtables are actually in a read- only section, so they just get mapped in as shared memory? (And if so, how does that work? I thought vtables had to be fixed up at load time since they're full of pointers to relocatable code.)

—Jens _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Are C++ vtables shared or private memory?
      • From: Jonas Maebe <email@hidden>
  • Prev by Date: Re: Singletons cause static analyzer warning
  • Next by Date: Re: Are C++ vtables shared or private memory?
  • Previous by thread: Re: Singletons cause static analyzer warning
  • Next by thread: Re: Are C++ vtables shared or private memory?
  • Index(es):
    • Date
    • Thread