Bug 11523
Summary: | WebBaseNetscapePluginView leaks like a mofo | ||
---|---|---|---|
Product: | WebKit | Reporter: | Steve Gehrman <steve> |
Component: | Plug-ins | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Major | CC: | kdecker, mrowe, steve |
Priority: | P1 | Keywords: | InRadar |
Version: | 420+ | ||
Hardware: | Mac | ||
OS: | OS X 10.4 |
Steve Gehrman
In my app, an interactive flash swf is constantly sending info back and forth to the client app and each communication creates a stream but never releases it. It was eating memory like crazy.
Add this to WebBaseNetscapePluginView.m
- (void)streamIsDead:(WebBaseNetscapePluginStream*)stream;
{
[[stream retain] autorelease];
// don't want to retain the stream anylonger
[streams removeObjectIdenticalTo:stream];
}
In WebBaseNetscaplePluginStream.m add this one line to setPluginPointer....
- (void)setPluginPointer:(NPP)pluginPointer
{
if (pluginPointer) {
instance = pluginPointer;
pluginView = [(WebBaseNetscapePluginView *)instance->ndata retain];
WebNetscapePluginPackage *plugin = [pluginView plugin];
NPP_NewStream = [plugin NPP_NewStream];
NPP_WriteReady = [plugin NPP_WriteReady];
NPP_Write = [plugin NPP_Write];
NPP_StreamAsFile = [plugin NPP_StreamAsFile];
NPP_DestroyStream = [plugin NPP_DestroyStream];
NPP_URLNotify = [plugin NPP_URLNotify];
} else {
instance = NULL;
[pluginView streamIsDead:self]; // <-- added this line only
[pluginView release];
pluginView = nil;
NPP_NewStream = NULL;
NPP_WriteReady = NULL;
NPP_Write = NULL;
NPP_StreamAsFile = NULL;
NPP_DestroyStream = NULL;
NPP_URLNotify = NULL;
}
}
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Thank you for making the fix! It would be easier (and therefore faster) to process if you could submit it according to the guidelines from <http://webkit.org/coding/contributing.html>.
Steve Gehrman
It would be easier and faster if you just fixed the code rather than wasting my time telling me to reformat my bug report. It's super simple.
Mark Rowe (bdash)
Thanks for your cooperation Steve.
Mark Rowe (bdash)
<rdar://problem/4946922>
David Kilzer (:ddkilzer)
Committed by kdecker in r19131.
David Kilzer (:ddkilzer)
Patch backed out in r19135 because it crashes espn.com.
David Kilzer (:ddkilzer)
Committed by kdecker in r19167.
http://trac.webkit.org/projects/webkit/changeset/19167
David Kilzer (:ddkilzer)
With a locally-built debug build of WebKit r19181 with Safari 2.0.4 (419.3) on Mac OS X 10.4.8 (8N1037), http://mail.yahoo.com/ now crashes (when you have that goofy persona-head-thingy defined):
objc: FREED(id): message destroyStreamWithError: sent to freed object=0xf487860
Trace/BPT trap
Stack trace:
Exception: EXC_BREAKPOINT (0x0006)
Code[0]: 0x00000002
Code[1]: 0x00000000
Thread 0 Crashed:
0 libobjc.A.dylib 0x90a5eb09 _objc_error + 86
1 libobjc.A.dylib 0x90a5eb40 __objc_error + 45
2 libobjc.A.dylib 0x90a5d1a0 _freedHandler + 53
3 com.apple.WebKit 0x003132a7 -[WebBaseNetscapePluginStream cancelLoadAndDestroyStreamWithError:] + 72 (WebBaseNetscapePluginStream.m:342)
4 com.apple.WebCore 0x0139af5b WebCore::NetscapePlugInStreamLoader::didReceiveResponse(WebCore::ResourceResponse const&) + 331 (NetscapePlugInStreamLoaderMac.mm:85)
5 com.apple.WebCore 0x013c6ced WebCore::ResourceLoader::didReceiveResponse(WebCore::ResourceHandle*, WebCore::ResourceResponse const&) + 31
6 com.apple.WebCore 0x013a698b -[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:] + 115 (ResourceHandleMac.mm:340)
7 com.apple.Foundation 0x9265e8a7 -[NSURLConnection(NSURLConnectionInternal) _sendDidReceiveResponseCallback] + 56
8 com.apple.Foundation 0x9265ce1f -[NSURLConnection(NSURLConnectionInternal) _sendCallbacks] + 614
9 com.apple.Foundation 0x9265cb41 _sendCallbacks + 201
10 com.apple.CoreFoundation 0x9082afd2 CFRunLoopRunSpecific + 1213
11 com.apple.CoreFoundation 0x9082ab0e CFRunLoopRunInMode + 61
12 com.apple.HIToolbox 0x92ddabef RunCurrentEventLoopInMode + 285
13 com.apple.HIToolbox 0x92dda2fd ReceiveNextEventCommon + 385
14 com.apple.HIToolbox 0x92dda154 BlockUntilNextEventMatchingListInMode + 81
15 com.apple.AppKit 0x9327f465 _DPSNextEvent + 572
16 com.apple.AppKit 0x9327f056 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 137
17 com.apple.Safari 0x00006cea 0x1000 + 23786
18 com.apple.AppKit 0x93278ddb -[NSApplication run] + 512
19 com.apple.AppKit 0x9326cd2f NSApplicationMain + 573
20 com.apple.Safari 0x0005f54a 0x1000 + 386378
21 com.apple.Safari 0x0005f471 0x1000 + 386161
David Kilzer (:ddkilzer)
(In reply to comment #8)
> With a locally-built debug build of WebKit r19181 with Safari 2.0.4 (419.3) on
> Mac OS X 10.4.8 (8N1037), http://mail.yahoo.com/ now crashes (when you have
> that goofy persona-head-thingy defined):
That would be the head of your Yahoo! Avatar.
David Kilzer (:ddkilzer)
FIx for mail.yahoo.com avatar committed by ddkilzer in r19182. Patch by Darin.
http://trac.webkit.org/projects/webkit/changeset/19182