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: PB and enforcing Stack Size



At 10:39 AM -0700 9/4/03, Gary Meyer wrote:
I wrote some code that uses a very simple, but very large array - It's a simple program after all. In fact the array is so large that if I compile the program from within PB, it generates an access violation at run time, when it tries to create the array. If I go into a terminal window and type "ulimit -s <a_large_number>" (larger than the default of 512) and then compile the code, it'll run, because it's using the larger stack size. But I can't get PB to use this larger stack size.

Does anyone know how to get PB to use a larger stack size than the default ?

You can use the linker's -stack_size flag to do this. From the ld man page:
-----
-stack_size value
Specifies the size of the stack segment value,
where value is a hexadecimal number rounded to the
segment alignment. The default segment alignment
is the target pagesize (currently, 1000 hexadecimal
for the PowerPC and 2000 hexadecimal for i386). If
-stack_addr is specified and -stack_size is not, a
default stack size specific for the architecture
being linked will be used and its value printed as
a warning message. This creates a segment named
__UNIXSTACK .
-----

There are two items to be aware of if you're planning to do this from PB:
1) PB links with gcc, so you'll have to specify the flag as '-Wl,-stack_size -Wl,<your stack size here>' to get gcc to pass it through to ld.
2) If you use -stack_size and don't specify a stack address with -stack_addr, you'll get a linker warning. It's probably easiest to ignore the warning, but you can get it to go away by using the -stack_addr flag.

Hope this helps,
Eric
_______________________________________________
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: 
 >PB and enforcing Stack Size (From: Gary Meyer <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.