This is on OS X 10.8.4.

I'm trying to animate something and draw as smoothly as possible.

While trying to utilize a display link callback I noticed a memory leak in my 
application.
After some experimentation I found out that this is not directly linked to the 
callback but instead also happens when I use a timer with a high enough firing 
rate to send -setNeedsDisplay:YES. (i.e. 0.03 seconds interval works fine, 0.01 
seconds interval leaks)

Here is an excerpt from Instruments:

#       Event Type      ∆ RefCt RefCt   Timestamp       Responsible Library     
Responsible Caller
        Malloc/Autorelease (2)  +1              00:00.760.561   Foundation      
-[NSCFTimer initWithFireDate:interval:target:selector:userInfo:repeats:]
0        Malloc +1      1       00:00.760.561   Foundation      -[NSCFTimer 
initWithFireDate:interval:target:selector:userInfo:repeats:]
1        Autorelease                    00:00.760.564   AppKit  
_handleWindowNeedsDisplayOrLayoutOrUpdateConstraints
2       CFRetain        +1      2       00:00.760.571   AppKit  __83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
        CFRetain/CFRelease (6)                  00:00.760.573   AppKit  
__83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
3        CFRetain       +1      3       00:00.760.573   AppKit  __83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
4        CFRetain       +1      4       00:00.760.576   AppKit  __83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
5        CFRetain       +1      5       00:00.760.578   AppKit  __83-[NSWindow 
_postWindowNeedsDisplayOrLayoutOrUpdateConstraintsUnlessPostingDisabled]_block_invoke_01208
11       CFRelease      -1      7       00:00.775.686   AppKit  _DPSNextEvent
12       CFRelease      -1      6       00:00.775.691   AppKit  _DPSNextEvent
13       CFRelease      -1      5       00:00.775.693   AppKit  _DPSNextEvent
6       CFRetain        +1      6       00:00.768.177   AppKit  _DPSNextEvent
7       CFRetain        +1      7       00:00.768.179   AppKit  _DPSNextEvent
        Retain/Release (2)                      00:00.768.184   Foundation      
__NSFireTimer
8        Retain +1      8       00:00.768.184   Foundation      __NSFireTimer
9        Release        -1      7       00:00.775.681   Foundation      
__NSFireTimer
10      CFRetain        +1      8       00:00.775.682   AppKit  _DPSNextEvent
14      CFRelease       -1      4       00:00.775.701   AppKit  _DPSNextEvent
15      CFRelease       -1      3       00:00.775.709   AppKit  _DPSNextEvent
16      CFRelease       -1      2       00:00.775.711   AppKit  _DPSNextEvent
17      CFRelease       -1      1       00:00.775.713   AppKit  _DPSNextEvent

It seems like when I call -setNeedsDisplay:YES the system is spawning a timer 
to do something later on and when those calls come in too fast, that timer is 
leaked.

Any idea what I could do about that?
(I tried calling -setNeedsDisplay:YES only if -needsDisplay is NO which didn't 
help.)

Is there a way I can draw as fast as possible without triggering this problem?


Andreas
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to