[Webkit-unassigned] [Bug 27831] Allow custom memory allocation control for JavaScriptCore's UString class

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 18 17:26:56 PST 2010


--- Comment #12 from Darin Adler <darin at apple.com>  2010-01-18 17:26:55 PST ---
Anders Carlsson explained to me what’s going wrong.

The problem is that RefPtr derives from FastAllocBase and so does UString.
Since the first member of UString is a RefPtr, it can’t be at the same address
of the FastAllocBase we are inheriting from. So padding is added, making the
object bigger.

This will happen any time the first data member of a class is an object of a
class that derives from FastAllocBase (or Noncopyable or anything else that
eventually leads up to FastAllocBase), and the class itself also derives from
FastAllocBase (or Noncopyable, etc.).

One way to eliminate the problem is to make FastAllocBase a class template and
inherit from FastAllocBase<X> so that each use of FastAllocBase is a unique
class, but this still won’t help in the case of Noncopyable.

We may want to file a new bug about this. FastAllocBase is probably making many
of our objects a bit bigger.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list