<html>
<head>
<base href="https://bugs.webkit.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - WebAssembly: report Memory usage to GC"
href="https://bugs.webkit.org/show_bug.cgi?id=170690">170690</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>WebAssembly: report Memory usage to GC
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jfbastien@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jfbastien@apple.com
</td>
</tr>
<tr>
<th>Depends on</th>
<td>170628
</td>
</tr>
<tr>
<th>Blocks</th>
<td>159775
</td>
</tr></table>
<p>
<div>
<pre>As part of <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - WebAssembly: manage memory better"
href="show_bug.cgi?id=170628">bug #170628</a> I noticed that we never report the memory allocated by WebAssembly.Memory to the GC. This change would do it:
Wasm::PageCount JSWebAssemblyMemory::grow(VM& vm, ExecState* exec, uint32_t delt
...
vm.heap.reportExtraMemoryAllocated(Wasm::PageCount(delta).bytes());
void JSWebAssemblyMemory::finishCreation(VM& vm)
...
heap()->reportExtraMemoryAllocated(m_memory->size());
JSWebAssemblyMemory::visitChildren(JSCell* cell, SlotVisitor& visitor)
...
visitor.reportExtraMemoryVisited(thisObject->memory().size());
I'm not sure it's the right thing to do though! The "initial" size seems like a good thing to report, but if we haven't actually backed it up with physical pages then it may severely over-estimate allocation and cause the GC to run too much.
This change is significant enough that I'll punt it to its own patch, after <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - WebAssembly: manage memory better"
href="show_bug.cgi?id=170628">bug #170628</a>.</pre>
</div>
</p>
<div id="referenced">
<hr style="border: 1px dashed #969696">
<b>Referenced Bugs:</b>
<ul>
<li>
[<a class="bz_bug_link
bz_status_NEW "
title="NEW - WebAssembly: support the newer spec"
href="https://bugs.webkit.org/show_bug.cgi?id=159775">Bug 159775</a>] WebAssembly: support the newer spec
</li>
<li>
[<a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - WebAssembly: manage memory better"
href="https://bugs.webkit.org/show_bug.cgi?id=170628">Bug 170628</a>] WebAssembly: manage memory better
</li>
</ul>
</div>
<br>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>