Jump to content
Developer Wiki and Function Reference Links ×

XCode: How to increase stacksize?


Stefan Bender

Recommended Posts

Dear developers,

 

On Mac I am currently investigating a strange crash that seems to be related to code in my plug-in but according to the debugger  the crash happens within Vectorworks itself while no thread of the plug-in shows up in the debugger. I suspect it could be a stack size issue and would like to increase the stack size, but couldn't find any clue in the XCode help.

 

Does someone have an idea? I tried adding some lines to the "other linker flags" (see attachment) , but don't know if this is the right place and correct syntax.

 

Any help would be greatly appreciated.

 

increase stacksize.png

Link to comment

It seem consistent with https://stackoverflow.com/questions/18909395/how-do-i-increase-the-stack-size-when-compiling-with-clang-on-os-x

However, you are not controlling the main program (VW), so I do not know if it makes any sense to try it for a plug-in.

 

Also exceeding the stack should be uncommon. Are you sure you have not an endless recursion somewhere? Or may be the crash is really in VW, because of what the plug-in has done just before.

Link to comment

Hi Nicolas,

 

thanks a lot for your reply! But I've been on that site before and it doesn't say anything about how to enter this value in XCode settings, it is just about batch commands.

I had stack issues before on Windows several times (VW crashed when entering functions with large local variables) so I had wanted to exclude that. 

Now I'm suspecting  IResourceManagerContentPtr->SetSelectedItemText(empty string), but the crash doesn' happen then but some time later when the code of the plug-in is not running anymore. Pointer is valid, of course. Doesn't look like recursion. Very strange.

 

Link to comment

For the bug itself, I have just two further ideas:
- does it crash too if you give an invalid, but non-empty string?

- Is your string in the form "" or is it an empty TXString? Does it make a difference?

 

As for stack size, may be you can change it on system level. sysctl(8) seems ti have two values concerning stacks:

kern.stack_size: 16384

kern.stack_depth_max: 10096

 

 

 

Link to comment

This behavior sounds familiar, but I can’t remember the specific issue. I believe it had something to do with using a copy instead of a pointer. The memory wasn’t properly released, so the crash happened when Vectorworks tried to access the memory block later on. 
 

Also, make sure you’re using the latest SDK. Occasionally a mismatch between the SDK and application versions can cause issues. 

Link to comment

I think I remember the cause of the issue. If I had declared a MCObjectHandle, but didn't immediately assign it, it does not initialize itself, so when the scope ended, if the handle wan't assigned later in the code, I would inadvertently delete something else in memory. 

i.e.

{
  MCObjectHandle hObject;

	if (conditionFalse)
  		hObject = drawThisThing();
}

Would eventually cause a crash later on. As opposed to:

{
  MCObjectHandle hObject = nullptr;

	if (conditionFalse)
  		hObject = drawThisThing();
}

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...