Increasing stack size of NSDocument's open file thread
Increasing stack size of NSDocument's open file thread
- Subject: Increasing stack size of NSDocument's open file thread
- From: Graham Cox <email@hidden>
- Date: Thu, 6 Jul 2017 15:57:17 +1000
Hi all,
I’m wondering if there’s a way to increase the stack size of the thread that
opens my NSDocument in the background.
NSThread has a -setStackSize: method which would work, but it must be set prior
to starting the thread. The problem is I don’t start the thread - Cocoa does.
By the time my (e.g.) -readFromFileWrapper:ofType:error: method is called, it’s
way too late.
I can programatically set the process stack limit using setrlimit(), but that
doesn’t seem to affect additional threads such as the document opening one.
Anyone any idea how this could be done?
(The reason is that sometimes my documents can get very recursive during
dearchiving - occasionally extremely large ones can hit the stack limit. Rather
than redesign the scheme to be flatter, simply increasing the stack limit would
probably get me out of this on the rare occasion it bites. After dearchiving,
the object graph is flat, so the stack limit increase only needs to be
temporary during dearchiving on the background thread).
—Graham
_______________________________________________
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