• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Increasing stack size of NSDocument's open file thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Increasing stack size of NSDocument's open file thread


  • Subject: Re: Increasing stack size of NSDocument's open file thread
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 6 Jul 2017 09:44:20 -0700

> On Jul 6, 2017, at 8:42 AM, Steve Mills <email@hidden> wrote:
>
> Why can't you spawn your own thread to do the recursive code? Create the
> NSThread, set its stack size, light its fuse to do the processing, and delete
> it.

This. Although I would also consider looking at your code to see if it can be
refactored to avoid using recursion; a recursive algorithm can always be turned
into an iterative one that uses a (growable) stack data structure to hold
state. Unbounded recursion can be dangerous, especially when it’s operating on
external data. If you do stick with the custom-thread approach, consider
putting in an explicit recursion-depth check in your code so you can abort it
cleanly before blowing up the stack.

—Jens
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Increasing stack size of NSDocument's open file thread
      • From: Graham Cox <email@hidden>
References: 
 >Increasing stack size of NSDocument's open file thread (From: Graham Cox <email@hidden>)
 >Re: Increasing stack size of NSDocument's open file thread (From: Alastair Houghton <email@hidden>)
 >Re: Increasing stack size of NSDocument's open file thread (From: Graham Cox <email@hidden>)
 >Re: Increasing stack size of NSDocument's open file thread (From: Steve Mills <email@hidden>)

  • Prev by Date: Re: Increasing stack size of NSDocument's open file thread
  • Next by Date: CloudKit - partialFailure and limitExceeded
  • Previous by thread: Re: Increasing stack size of NSDocument's open file thread
  • Next by thread: Re: Increasing stack size of NSDocument's open file thread
  • Index(es):
    • Date
    • Thread