Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: increasing stack size



i have a program that has a task on a pthread that is running out of stack size (crashes in memcpy) i cant get pb to allow me to set the stack_size parameter to the linker. tried

Xlinker stack_size xxxx, W1, stack=xxx some other variants of this on the link options other macho link flags line.

can anyone point me at how to increase the stack available to a carbon app?

thanks jim

Are you actually using pthreads? Then you must be using mach-o, and this will work (semi-pseudo code, no error checking).

pthread_attr_t theAttributes;
pthread_attr_init(&theAttributes);

if (stackSize > PTHREAD_STACK_MIN)
{
size_t currStackSize;
pthread_attr_getstacksize(&theAttributes, &currStackSize);
if (stackSize != currStackSize)
{
currStackSize = stackSize;
pthread_attr_setstacksize(&theAttributes, currStackSize);
}

pthread_create(&theThread, &theAttributes,
startRoutine, startRoutineData);
}

If you're using the MPLibrary, then I think there is a call to set the stack size for a thread; see CarbonCore/Multiprocessing.h.

--Ron
_______________________________________________
projectbuilder-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/projectbuilder-users
Do not post admin requests to the list. They will be ignored.

References: 
 >increasing stack size (From: jim hopper <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.