VDKQueue icon indicating copy to clipboard operation
VDKQueue copied to clipboard

Leaks introduced when running against ARC code

Open tiennou opened this issue 12 years ago • 2 comments

I think it's because of Foundation being built with ARC enabled. This makes it so that some objects that weren't going through an autorelease pool now do, causing the NSThread to leak those objects.

malloc_history proof :

ALLOC 0x136429270-0x1364292ff [size=144]: thread_115b04000 |-[VDKQueue
watcherThread:] | -[NSObject(NSObject) autorelease] |
_CFAutoreleasePoolAddObject | CFLog | _CFLogvEx |
_CFStringCreateWithFormatAndArgumentsAux | CFStringCreateCopy |
__CFStringCreateImmutableFunnel3 | _CFRuntimeCreateInstance |
malloc_zone_malloc
----
FREE 0x136429270-0x1364292ff [size=144]: thread_115b04000 |-[VDKQueue
watcherThread:] | -[NSObject(NSObject) autorelease] |
_CFAutoreleasePoolAddObject | CFLog | _CFLogvEx | _CFRelease |
malloc_zone_free

tiennou avatar Jul 31 '13 15:07 tiennou

Yea, you'll want to modify the code to make it Arc-compliant if you use it in that environment.

I'm not a fan of ARC, but I'll try to do this for the repo in the near future.

Sent from my iPhone

On Jul 31, 2013, at 8:00, Etienne Samson [email protected] wrote:

I think it's because of Foundation being built with ARC enabled. This makes it so that some objects that weren't going through an autorelease pool now do, causing the NSThread to leak those objects.

malloc_history proof :

ALLOC 0x136429270-0x1364292ff [size=144]: thread_115b04000 |-[VDKQueue watcherThread:] | -[NSObject(NSObject) autorelease] | _CFAutoreleasePoolAddObject | CFLog | _CFLogvEx | _CFStringCreateWithFormatAndArgumentsAux | CFStringCreateCopy | __CFStringCreateImmutableFunnel3 | _CFRuntimeCreateInstance |

malloc_zone_malloc

FREE 0x136429270-0x1364292ff [size=144]: thread_115b04000 |-[VDKQueue watcherThread:] | -[NSObject(NSObject) autorelease] | _CFAutoreleasePoolAddObject | CFLog | _CFLogvEx | _CFRelease | malloc_zone_free — Reply to this email directly or view it on GitHub.

bdkjones avatar Jul 31 '13 19:07 bdkjones

look at https://github.com/bdkjones/VDKQueue/pull/11 …

@tiennou you can checkout from my repo and then recompile using ARC, that should fix the leaks…

sebikeller avatar Feb 06 '14 16:02 sebikeller