Bug 180320 - System colors leak
Summary: System colors leak
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-12-02 16:00 PST by Alexey Proskuryakov
Modified: 2017-12-04 10:34 PST (History)
3 users (show)

See Also:


Attachments
standalone test (2.88 KB, text/plain)
2017-12-02 17:09 PST, Darin Adler
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2017-12-02 16:00:21 PST
I'm getting a reproducible leak of NSDynamicSystemColor and NSCalibratedRGBColor when running WebKit tests.

Steps to reproduce:

run-webkit-tests -1 --leaks --no-retry --no-build --no-show --no-sample --debug-rwt-logging --clobber-old-results fast/css/test-setting-canvas-color.html --repeat 10
Comment 1 Radar WebKit Bug Importer 2017-12-02 16:01:05 PST
<rdar://problem/35816332>
Comment 2 Alexey Proskuryakov 2017-12-02 16:04:59 PST
It looks like it has to be in this code, but I don't see the problem.

        if (auto selector = selectCocoaColor()) {
            if (auto color = wtfObjcMsgSend<NSColor *>([NSColor class], selector))
                return convertNSColorToColor(color);
        }
Comment 3 Darin Adler 2017-12-02 16:38:15 PST
Maybe we can extract that code into a small command line tool to see if it leaks. Very little dependency on the rest of WebKit in that code.
Comment 4 Darin Adler 2017-12-02 17:09:00 PST
Created attachment 328267 [details]
standalone test

No leak seen with this test.
Comment 5 Darin Adler 2017-12-02 17:12:36 PST
Another thing to test: Comment out that code and see if the leak goes away.
Comment 6 Alexey Proskuryakov 2017-12-03 14:49:32 PST
Turns out that it's not every color, but [NSColor controlHighlightColor] leaks on my OS version. Will keep tracking this in radar.
Comment 7 Joseph Pecoraro 2017-12-04 10:34:20 PST
Whoa, I never know about `leaks --atExit`! I normally just added a `sleep(10000)` to my main so I could run leaks in another tab. Some good pro-tips in this thread for leaks debugging.