<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - NetworkCache: Web process leaks resource buffer when using shareable reasources"
href="https://bugs.webkit.org/show_bug.cgi?id=154852#c6">Comment # 6</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED FIXED - NetworkCache: Web process leaks resource buffer when using shareable reasources"
href="https://bugs.webkit.org/show_bug.cgi?id=154852">bug 154852</a>
from <span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=154852#c5">comment #5</a>)
<span class="quote">> I can see how this avoids refcount churn, however I don't see how this can
> fix a leak. What am I missing?
>
> + ResourceLoader::didReceiveBuffer() expects a PassRefPtr, but we
> + are passing a raw pointer making PassRefPtr to take another
> + reference instead of transfering the ownership as expected.
>
> This was compensated by the original RefPtr still having a pointer to the
> object, so there was also one more deref().</span >
hmm, you are indeed right. When passing the raw pointer, the PassRefPtr takes another ref but the original RefPtr releases its own when didReceiveResource() finishes. I was doing a lot of tests and didn't see any ShareableResource freed before applying this patch, but I guess I didn't disable the memory cache either. So, maybe there's no leak but when using a single web process we end up with a lot of resources cached in memory keeping their fds alive. We might consider copying the data in the web process and releasing the mmap.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>