Bug 175113 - NeverDestroyed related leaks seen on bots
Summary: NeverDestroyed related leaks seen on bots
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-08-02 20:34 PDT by Joseph Pecoraro
Modified: 2017-08-03 12:08 PDT (History)
11 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (1.18 KB, patch)
2017-08-02 20:36 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix (1.68 KB, patch)
2017-08-02 20:41 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2017-08-02 20:34:05 PDT
New leaks seen on leaks bots:
<https://build.webkit.org/builders/Apple%20Sierra%20(Leaks)>

Seems closely related to r219595:
<https://trac.webkit.org/r219595>

Leak: 0x7fdd561010a0  size=16  zone: WebKit Using System Malloc_0x10d4e5000
	0x56101080 0x00007fdd 0xaaaaaaaa 0xaaaaaaaa 	...V............
	Call stack: [thread 0x7fffe04163c0]: 
        | start 
        | DumpRenderTreeMain(int, char const**) DumpRenderTree.mm:1398 
        ...
        | WebCore::DocumentLoader::maybeLoadEmpty() DocumentLoader.cpp:1411 
        | WebCore::SchemeRegistry::shouldLoadURLSchemeAsEmptyDocument(WTF::String const&amp;) SchemeRegistry.cpp:311 
        | WebCore::makeNeverDestroyedSchemeSet(WTF::Vector&lt;WTF::String, 0ul, WTF::CrashOnOverflow, 16ul&gt; const&amp; (*)()) SchemeRegistry.cpp:62 
        | WebCore::builtinEmptyDocumentSchemes() SchemeRegistry.cpp:166 
        | WTF::fastMalloc(unsigned long) FastMalloc.cpp:258 
        | bmalloc::DebugHeap::malloc(unsigned long) DebugHeap.cpp:49 

Reduced test that produces the same leak:

> #import <wtf/Vector.h>
> #import <wtf/NeverDestroyed.h>
> 
> const Vector<int>& test() {
>     static const auto x = makeNeverDestroyed(Vector<int> { 1, 2, 3 });
>     return x;
> }
> 
> static void leak() {
>     test();
> }
> 
> int main() {
>     @autoreleasepool { leak(); }
>     sleep(100000);
>     return 0;
> }
Comment 1 Joseph Pecoraro 2017-08-02 20:36:51 PDT
Created attachment 317079 [details]
[PATCH] Proposed Fix
Comment 2 Joseph Pecoraro 2017-08-02 20:41:40 PDT
Created attachment 317083 [details]
[PATCH] Proposed Fix
Comment 3 Yusuke Suzuki 2017-08-02 21:16:42 PDT
Comment on attachment 317083 [details]
[PATCH] Proposed Fix

r=me
Comment 4 WebKit Commit Bot 2017-08-02 21:46:50 PDT
Comment on attachment 317083 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 317083

Committed r220183: <http://trac.webkit.org/changeset/220183>
Comment 5 WebKit Commit Bot 2017-08-02 21:46:51 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2017-08-02 21:48:01 PDT
<rdar://problem/33693214>
Comment 7 Darin Adler 2017-08-03 09:38:41 PDT
Thanks so much for fixing this! Really important fix, and very sorry for my mistake. Can we add a TestWebKitAPI test to cover this please?
Comment 8 Joseph Pecoraro 2017-08-03 12:08:52 PDT
(In reply to Darin Adler from comment #7)
> Thanks so much for fixing this! Really important fix, and very sorry for my
> mistake. Can we add a TestWebKitAPI test to cover this please?

Bug 175146