4

The docs for -[NSURL startAccessingSecurityScopedResource] state:

You must balance every call to the startAccessingSecurityScopedResource method with a corresponding call to the stopAccessingSecurityScopedResource method. If you fail to relinquish your access when you no longer need a file-system resource, your app leaks kernel resources. If sufficient kernel resources are leaked, your app loses its ability to add file-system locations to its sandbox, such as via Powerbox or security-scoped bookmarks, until relaunched.

Can anybody shed any light on what the limit on kernel resources actual is?

I don't wish to make my app reach these exact limits, just that it would be helpful to know a ballpark figure so I can judge if code is ever doing anything dangerous/stupid.

Mike Abdullah
  • 14,933
  • 2
  • 50
  • 75
  • You're just asking out of curiosity? As long as your start/stop calls are balanced, there shouldn't be a problem. Are you trying to find out how deeply you can nest start calls before it becomes a problem? – Dov Apr 26 '13 at 15:45
  • I'm not asking how deeply calls can be nested, although that is an interesting question of itself! – Mike Abdullah Apr 26 '13 at 17:46
  • I'm interested to know roughly how many requests can be in flight at once. The docs suggest there is some sort of hard limit, and balancing calls is not enough if you happen to go over the limit at some point – Mike Abdullah Apr 26 '13 at 17:47

1 Answers1

4

Ballpark figure is between 1000 and 2500. I read three recent discussions in the Developer Forums at apple. If you are a registered developer at apple you may find it here:

mahal tertin
  • 3,239
  • 24
  • 41