<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:΢ź
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<div>Hi <span style="font-size: 10pt; ">japhet@chromium.org</span></div><div><br></div><div>Thanks for your reply :)</div>The <a href="https://bugs.webkit.org/show_bug.cgi?id=82287">bug#82287</a> has been filed.<div><br></div><div>Best Regards</div><div>Rock<br><div><br><div><div id="SkyDrivePlaceholder"></div><hr id="stopSpelling">Date: Mon, 26 Mar 2012 08:44:36 -0700<br>Subject: Re: [webkit-dev] About WebKit memory cache<br>From: japhet@chromium.org<br>To: porgao@hotmail.com<br>CC: webkit-dev@lists.webkit.org<br><br>On Fri, Mar 23, 2012 at 7:48 PM, gaorock <span dir="ltr"><<a href="mailto:porgao@hotmail.com">porgao@hotmail.com</a>></span> wrote:<br><div class="ecxgmail_quote"><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex">



<div><div dir="ltr">
<div>Hi all</div><div><br></div><div>Sometimes I met crashes about memory cache, and I traced them and found a bit doubt:</div><div><br></div><div>Should we use </div><div>typedef HashMap<String, <font color="#ff0000">RefPtr<CachedResource></font>> CachedResourceMap;</div>
<div>instead of </div><div>typedef HashMap<String, CachedResource*> CachedResourceMap;?</div></div></div></blockquote><div><br></div><div>CachedResource doesn't support reference counting in the usual model.  It uses a somewhat confusing set of rules to decide when to delete itself. See canDelete() in CachedResource.h. Figuring out a way to make CachedResource use our normal reference counting model is on my list of things to do someday. :-)</div>
<div> </div><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex"><div><div dir="ltr"><div><br></div><div>The following is the call stack, hope it's useful for you:</div>
<div><br></div><div> <span style="white-space:pre-wrap">   </span>WebKit.dll!WebCore::ResourceRequestBase::updateResourceRequest()  Line447 + 0x37 byte<span style="white-space:pre-wrap">      </span>C++</div><div> <span style="white-space:pre-wrap">        </span>WebKit.dll!WebCore::ResourceRequestBase::url()  Line123<span style="white-space:pre-wrap">    </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::CachedResource::url()  Line106 + 0x19 byte<span style="white-space:pre-wrap">     </span>C++</div><div>><span style="white-space:pre-wrap">  </span>WebKit.dll!WebCore::CachedResourceLoader::requestResource(WebCore::CachedResource::Type type=ImageResource, WebCore::ResourceRequest & request={...}, const WTF::String & charset={...}, const WebCore::ResourceLoaderOptions & options={...}, WebCore::ResourceLoadPriority priority=-1, bool forPreload=false)  Line444 + 0x11 byte<span style="white-space:pre-wrap">  </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::CachedResourceLoader::requestImage(WebCore::ResourceRequest & request={...})  Line160 + 0x21 byte<span style="white-space:pre-wrap">  </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::CSSImageValue::cachedImage(WebCore::CachedResourceLoader * loader=0x00e6e6d8, const WTF::String & url={...})  Line90 + 0xf byte<span style="white-space:pre-wrap">    </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::CSSImageValue::cachedImage(WebCore::CachedResourceLoader * loader=0x00e6e6d8)  Line79 + 0x19 byte<span style="white-space:pre-wrap">      </span>C++</div><div>
 <span style="white-space:pre-wrap">       </span>WebKit.dll!WebCore::CSSStyleSelector::loadPendingImage(WebCore::StylePendingImage * pendingImage=0x0ada6f30)  Line5306 + 0xc byte<span style="white-space:pre-wrap">  </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::CSSStyleSelector::loadPendingImages()  Line5331 + 0x15 byte<span style="white-space:pre-wrap">    </span>C++</div><div> <span style="white-space:pre-wrap">        </span>WebKit.dll!WebCore::CSSStyleSelector::applyMatchedDeclarations(const WebCore::CSSStyleSelector::MatchResult & matchResult={...})  Line2408<span style="white-space:pre-wrap">     </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::CSSStyleSelector::styleForElement(WebCore::Element * element=0x0ad08088, WebCore::RenderStyle * defaultParent=0x00000000, bool allowSharing=true, bool resolveForRootDefault=false)  Line1310<span style="white-space:pre-wrap">  </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::Element::styleForRenderer()  Line1035 + 0x24 byte<span style="white-space:pre-wrap">      </span>C++</div><div> <span style="white-space:pre-wrap">        </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1059 + 0xc byte<span style="white-space:pre-wrap">  </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1138<span style="white-space:pre-wrap">     </span>C++</div><div> <span style="white-space:pre-wrap">        </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1138<span style="white-space:pre-wrap">     </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1138<span style="white-space:pre-wrap">     </span>C++</div><div> <span style="white-space:pre-wrap">        </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1138<span style="white-space:pre-wrap">     </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1138<span style="white-space:pre-wrap">     </span>C++</div><div> <span style="white-space:pre-wrap">        </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1138<span style="white-space:pre-wrap">     </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1138<span style="white-space:pre-wrap">     </span>C++</div><div> <span style="white-space:pre-wrap">        </span>WebKit.dll!WebCore::Element::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1138<span style="white-space:pre-wrap">     </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::Document::recalcStyle(WebCore::Node::StyleChange change=NoChange)  Line1574<span style="white-space:pre-wrap">    </span>C++</div><div> <span style="white-space:pre-wrap">        </span>WebKit.dll!WebCore::Document::updateStyleIfNeeded()  Line1634<span style="white-space:pre-wrap">      </span>C++</div>
<div> <span style="white-space:pre-wrap">    </span>WebKit.dll!WebCore::Document::updateLayout()  Line1658 + 0x12 byte<span style="white-space:pre-wrap"> </span>C++</div><div><br></div><div>In the function of <span style="font-size:10pt">WebCore::ResourceRequestBase::updateResourceRequest(), the point "this" is NOT null, but all of its members are null, so actually it had been freed before. So I think the refCount may be helpful to solve this problem.</span></div>
<div><br></div><div>This is my first time to write to WebKit-dev, it will be appreciated if someone could give me some instructions or whether I should file a bug for it?</div></div></div></blockquote><div><br></div><div>
Yes, please file a bug on <a href="http://bugs.webkit.org" target="_blank">bugs.webkit.org</a>, and feel free to point me in its direction.</div><div> </div><blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr"><div><br></div><div>Thanks in advance!</div><div><br></div><div>Best Regards</div><div>Rock</div>                                       </div></div>
<br>_______________________________________________<br>
webkit-dev mailing list<br>
<a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
<a href="http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev" target="_blank">http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev</a><br>
<br></blockquote></div><br></div></div></div>                                           </div></body>
</html>