| Summary: | GraphicsContext state stack wasting lots of memory when empty. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Andreas Kling <kling> | ||||
| Component: | Canvas | Assignee: | Andreas Kling <kling> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | commit-queue, ggaren, kling | ||||
| Priority: | P2 | Keywords: | Performance | ||||
| Version: | 528+ (Nightly build) | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Andreas Kling
2015-06-09 14:33:27 PDT
Created attachment 254604 [details]
Patch
Comment on attachment 254604 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254604&action=review r=me > Source/WebCore/platform/graphics/GraphicsContext.cpp:140 > + // Make sure we deallocate the state stack buffer when it goes empty. > + // Canvas elements will immediately save() again, but that goes into inline capacity. > + if (m_stack.isEmpty()) > + m_stack.clear(); Should Vector do this automatically? To elaborate, I really hate it that std::vector does not do this automatically. At the limit, you have to add a call to clear to every client! (In reply to comment #3) > To elaborate, I really hate it that std::vector does not do this > automatically. At the limit, you have to add a call to clear to every client! I guess you mean WTF::Vector. We can totes do that. Let's separate the issues though. > > To elaborate, I really hate it that std::vector does not do this
> > automatically. At the limit, you have to add a call to clear to every client!
>
> I guess you mean WTF::Vector.
> We can totes do that. Let's separate the issues though.
No, I mean that std::vector never ever shrinks until you call shrink_to_fit, which is super annoying, while WTF::Vector often shrinks automatically, but misses in this case.
Comment on attachment 254604 [details] Patch Clearing flags on attachment: 254604 Committed r185396: <http://trac.webkit.org/changeset/185396> All reviewed patches have been landed. Closing bug. |