<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>252059</bug_id>
          
          <creation_ts>2023-02-10 09:11:27 -0800</creation_ts>
          <short_desc>[run-webkit-tests] found several memory leak while running with --world-leaks</short_desc>
          <delta_ts>2024-08-28 16:29:22 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=251834</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="cathiechen">cathiechen</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>cathiechen</cc>
    
    <cc>jbedard</cc>
    
    <cc>koivisto</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>rreno</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1932669</commentid>
    <comment_count>0</comment_count>
    <who name="cathiechen">cathiechen</who>
    <bug_when>2023-02-10 09:11:27 -0800</bug_when>
    <thetext>While run-webkit-tests with --world-leaks on Mac WK2, it reports some memory leak.

For instance, run it for imported/w3c/web-platform-tests/css/css-sizing/

14:46:42.469 25391 Testing completed, Exit status: 9
=&gt; Results: 366/389 tests passed (94.1%)

=&gt; Tests to be fixed (24):
     13 image-only failures      (54.2%)
      8 leaks                    (33.3%)

=&gt; Tests that will only be fixed if they crash (WONTFIX) (0):


Unexpected flakiness: leaks (8)
  imported/w3c/web-platform-tests/css/css-sizing/animation/aspect-ratio-interpolation.html [ Pass Leak ]
  imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio-affects-container-width-when-height-changes.html [ Pass Leak ]
  imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-001.html [ Pass Leak ]
  imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/parsing/aspect-ratio-computed.html [ Pass Leak ]
  imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/zero-or-infinity-006.html [ Pass Leak ]
  imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/animation/contain-intrinsic-size-interpolation.html [ Pass Leak ]
  imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/auto-001.html [ Pass Leak ]
  imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/parsing/contain-intrinsic-size-computed.html [ Pass Leak ]

Tried code on Jan 31, b4048150686363c, there is no complaint.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1934639</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-02-17 09:12:19 -0800</bug_when>
    <thetext>&lt;rdar://problem/105599530&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1934659</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2023-02-17 10:18:16 -0800</bug_when>
    <thetext>This suggests that something is triggering a retain cycle between the Document and other objects</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1935144</commentid>
    <comment_count>3</comment_count>
    <who name="cathiechen">cathiechen</who>
    <bug_when>2023-02-20 10:47:38 -0800</bug_when>
    <thetext>[1] https://bugs.webkit.org/show_bug.cgi?id=251834

Looks like [1] introduced this.
Yes, before this change, run-webkit-tests with --world-leaks crashes.
I used below to work around it temporarily.

diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp
index 9f9bf7fa7e3e..b808251b7b56 100644
--- a/Tools/WebKitTestRunner/TestController.cpp
+++ b/Tools/WebKitTestRunner/TestController.cpp
@@ -1784,8 +1784,10 @@ void TestController::didReceiveLiveDocumentsList(WKArrayRef liveDocumentList)
 
     HashMap&lt;uint64_t, String&gt; documentInfo;
     for (size_t i = 0; i &lt; numDocuments; ++i) {
-        if (auto dictionary = dictionaryValue(WKArrayGetItemAtIndex(liveDocumentList, i)))
-            documentInfo.add(uint64Value(dictionary, &quot;id&quot;), toWTFString(stringValue(dictionary, &quot;url&quot;)));
+        if (auto dictionary = dictionaryValue(WKArrayGetItemAtIndex(liveDocumentList, i))) {
+            if (auto id = uint64Value(dictionary, &quot;id&quot;))
+                documentInfo.add(id, toWTFString(stringValue(dictionary, &quot;url&quot;)));
+        }
     }
 
     if (!documentInfo.size()) {</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1935160</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2023-02-20 11:05:21 -0800</bug_when>
    <thetext>I fixed that recently on trunk.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1935174</commentid>
    <comment_count>5</comment_count>
    <who name="cathiechen">cathiechen</who>
    <bug_when>2023-02-20 11:40:38 -0800</bug_when>
    <thetext>So the document leak is true?
We didn&apos;t find out because run-webkit-tests with --world-leaks crashes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1935179</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2023-02-20 11:45:11 -0800</bug_when>
    <thetext>Oh, you&apos;re saying that it might not be a regression, simply because the detection didn&apos;t work before? That might be true. You&apos;d have to apply the WebKitTestRunner fix to older builds to test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1935205</commentid>
    <comment_count>7</comment_count>
    <who name="cathiechen">cathiechen</who>
    <bug_when>2023-02-20 12:26:03 -0800</bug_when>
    <thetext>OK, applied the WebKitTestRunner fix to the code on Jan 31, b4048150686363c, there is memory leak too.
So it is not a regression from that commit...</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>