• 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
Stack size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Stack size


  • Subject: Stack size
  • From: "Simson Garfinkel" <email@hidden>
  • Date: Thu, 27 Dec 2001 06:19:00 -0500

Take a look at getrlimit() and setrlimit(). You need to do a "man getrlimit"
from the command line. If you need sample code, let me know, but this is
pretty straightforward.

BTW, allocating things on the stack is a great trick! But I prefer using
alloca() for big values. The code is generally more clear, it's easier to
change stack-allocation to non-stack allocation, and on some platforms
alloca allows you to check return values and do sensible things.

> Message: 3
> Date: Thu, 27 Dec 2001 01:39:26 +0100
> Subject: Stack size
> From: Hampus Edvardsson <email@hidden>
> To: email@hidden
>
> I am trying to build and run a program that needs to allocate 512 kB on
> the stack (by doing: int data[512*256];). The code compiles but when I
> run it, it gets a EXC_BAD_ACCESS signal and dies.
>
> I found out that the reason this happens is because the default maximum
> stack size is set to 512 kbytes, and that that value could be changed in
> tcsh with the command "limit stacksize 8192". After giving that command
> the application runs fine when started from the same terminal.
>
> Is there any way to specify the maximum stack size inside the
> application, so it will run when started from the finder?


  • Follow-Ups:
    • Re: Stack size
      • From: Hampus Edvardsson <email@hidden>
  • Prev by Date: Accessing carbon calls from within cocoa
  • Next by Date: Re: Stack size
  • Previous by thread: Re: Stack size
  • Next by thread: Re: Stack size
  • Index(es):
    • Date
    • Thread