[webkit-reviews] review granted: [Bug 225838] GraphicsLayer::setName() causes heap fragmentation : [Attachment 428702] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 14 20:32:17 PDT 2021


Darin Adler <darin at apple.com> has granted Geoffrey Garen <ggaren at apple.com>'s
request for review:
Bug 225838: GraphicsLayer::setName() causes heap fragmentation
https://bugs.webkit.org/show_bug.cgi?id=225838

Attachment 428702: Patch

https://bugs.webkit.org/attachment.cgi?id=428702&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 428702
  --> https://bugs.webkit.org/attachment.cgi?id=428702
Patch

r=me, I guess, but how well does this work?

These names eventually are turned into NSString objects by
PlatformCALayerCocoa::setName. Is there some guarantee those won’t cause the
same kind of fragmentation? I’d think we’d want a scheme where these names end
up being a single set of NSString objects, one for each individual names.
Doesn’t seem necessary for the literals to ever be turned into WTF::String; the
WTF::String is just a way to ferry the data along to get to the NSString,
except for the case of "structural layers". Looking into those, it looks like
nothing prevents GraphicsLayerCA::updateNames from creating a new WTF::String
each time!

I’d try to go further like I am saying above, because I would be surprised if
the WTF::String objects were causing fragmentation in a way that the NSString
objects we make from them are not.

Likely we can take advantage of a fixed set of layer names to make sure we
don't do allocation, at the risk of having layer name machinery be a little
less cleanly cross-platform.


More information about the webkit-reviews mailing list