Threads + Garbage Collection = Crash?
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=/eGupiiOdh32Fh4GxVH+gEyYGANKofsP6wq4dzQ2T0A=; b=c8H6u4ZaABPa7K5RIzsw1HdArl0VznwldLVO6D0uaphNhEvrI9IQocLODMot7EJe0C jMSlqI0HQBItMkIGvdjwinnGDoUlfmtfb8QPkH3u/B6Th6QGBv9ypQ9vesEMDCcTuzLd /ZwcVLWtEPrjSeDPt854Z7xRd6GQphTKvtpR4= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=FbgSoJpeUK5ZkpmPWp0dkBlgdr2QQUSiayX1TgKEyWV//2fdUJrxjWVpJvYyPNcvPz VqxfPuq9O4loroIwpRlFOOIJubUlI8j5jY5rGwlzmnp3t2MzUB5jo8wvj7KE7xBTFfTd 08tAYJd/vuoPz7udM8B+6dvtMCC8ILaAP7Thc= In my application, I create a (single) background thread, for creating thumbnail images. I use NSRunLoop and - [NSObject performSelector:onThread:withObject:waitUntilDone:] to communicate between the main and the background threads. I am experiencing weird random crashes with the following log: IconView(49550,0xb0103000) malloc: free_garbage: garbage ptr = 0x1239260, has non-zero refcount = 1 IconView(49550,0xb0103000) malloc: *** free() called with 0x1bdcf6b0 with refcount 0 IconView(49550,0xb0103000) malloc: *** auto malloc[49550]: agc error for object 0x1bdcf6b0: Deallocating a non-block My application relies heavily on garbage collection (the gc required mode), so I never call malloc/free explicitly. I don't create NSAutoreleasePool in the background thread's main method. I set breakpoint on malloc_printf and I see the following stack trace: malloc_printf autocollect_internal autocollection_thread _pthread_start thread_start. I have noticed that these crashes occur more often when the workload is high - i.e. there are many sequential requests to the background thread. Also, I have located a piece of code in the main thread such that when I comment it out, the crash disappears, although the code fragment has absolutely nothing to do with the background thread. It actually fills a round rect with a gradient fill, in the main thread. Funny enough, when the rect is square, not round, the bug also disappears. I don't use NSOpenPanel in my application. I have exhausted all my versions about what could be wrong. Any ideas? _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... This email sent to site_archiver@lists.apple.com
participants (1)
-
Oleg Krupnov