objc[41140]: Object 0x7fc0b70fa430 of class __NSCFString autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug (lldb) bt * thread #39: tid = 0x1dc29a, 0x00007fff927f2a0d libobjc.A.dylib`objc_autoreleaseNoPool, stop reason = breakpoint 1.1 frame #0: 0x00007fff927f2a0d libobjc.A.dylib`objc_autoreleaseNoPool frame #1: 0x00007fff927de402 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::autoreleaseSlow(objc_object*) + 108 frame #2: 0x00007fff927f2bec libobjc.A.dylib`_objc_rootAutorelease2(objc_object*) + 75 frame #3: 0x0000000110626021 WebCore`WTF::StringImpl::operator NSString*() [inlined] WTF::RetainPtr<__CFString const*>::leakRef(this=0x0000000000000000, this=0x0000000000000000, this=0x0000000000000000) + 44 at FoundationExtras.h:38 frame #4: 0x0000000110625ff5 WebCore`WTF::StringImpl::operator NSString*(this=<unavailable>) + 21 at StringImplMac.mm:31 frame #5: 0x000000010fdff335 WebCore`setMetaData [inlined] WTF::String::operator NSString*() const + 23 at WTFString.h:424 frame #6: 0x000000010fdff31e WebCore`setMetaData(context=0x00000001150e5a68) + 30 at FileSystemMac.mm:80 frame #7: 0x00007fff8e30b7a2 libsystem_c.dylib`_pthread_start + 327 frame #8: 0x00007fff8e2f81e1 libsystem_c.dylib`thread_start + 13
<rdar://problem/14738085>
Created attachment 208751 [details] [PATCH] Proposed Fix
* STEPS TO REPRODUCE 1. Open <http://bogojoker.com> in Safari 2. Drag an image to your desktop => leaks
* LEAK (allocation backtrace) Leak: 0x7f8617e96820 size=64 zone: DefaultMallocZone_0x106134000 __NSCFString ObjC CoreFoundation "/Users/pecoraro/Desktop/bogojoker.png" Call stack: [thread 0x10bad7000]: | thread_start | _pthread_start | WebCore::setMetaData(void*) | WTF::StringImpl::operator NSString*() | WTF::StringImpl::createCFString() | CFStringCreateWithBytes | __CFStringCreateImmutableFunnel3 | _CFRuntimeCreateInstance | malloc_zone_malloc
Comment on attachment 208751 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=208751&action=review > Source/WebCore/platform/mac/FileSystemMac.mm:77 > static void* setMetaData(void* context) Mitz has a good suggestion. Instead of spawning a pthread for setMetaData (old code) we can just dispatch a block to do this. I'll look into that.
Created attachment 208768 [details] [PATCH] Proposed fix - convert pthread to dispatch block Verified this by dragging and dropping images out of Safari to the Desktop and checking the "Get Info" finder window for "Where from" information.
Comment on attachment 208768 [details] [PATCH] Proposed fix - convert pthread to dispatch block View in context: https://bugs.webkit.org/attachment.cgi?id=208768&action=review > Source/WebCore/platform/mac/FileSystemMac.mm:81 > + wkSetMetadataURL(URLStringCopy, referrerCopy, (NSString *)String::fromUTF8(fileSystemRepresentation(pathCopy).data())); You should just use -[NSString fileSystemRepresentation].
Committed <http://trac.webkit.org/changeset/154086>.