Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3801234
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:01:07+00:00 2026-05-19T14:01:07+00:00

In Unix, there’s getrusage function to get the resource status. It is in Mac

  • 0

In Unix, there’s getrusage function to get the resource status. It is in Mac OS X too, but it does not work. There’s pre-implemented API on Cocoa(I don’t know about Carbon),

-[NSthread stackSize]

but I have to implement it with only C API.

What’s the equivalent C API with that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T14:01:07+00:00Added an answer on May 19, 2026 at 2:01 pm

    You have to do this before creating the thread, by initializing a pthread_attr_t object and calling pthread_attr_getstacksize on it. If you know the current thread was created with the default attributes, you could probably defer the test until later, but it sounds like a bad idea.

    With that said, I think testing the default is rather useless anyway. If you know you need a large stack, explicitly set a large stack size before creating the thread. If you know you only need a small stack, explicitly set that and enjoy the memory savings. I would recommend not going any lower than 32k unless you know you won’t be using any library functions or recursion (in which case 4k is probably fine), nor any larger than 256k unless you intend to do some deep recursion. A rough estimate I’d use for getting a safe stack size for recursion is:

    levels_of_recursion * (128 + total_size_of_locals) + (using_lib ? 32768 : 4096)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to get the instruction pointer of a running application Unix?
Is there a Mac/Unix commands that lets you see the local network in terms
Is there an equivalent of the UNIX 'which' command, i.e. for given resource(s), traverse
There is a simple way to get unix time range of a day if
In Unix Network Programming there is an example of a Pre-forked server which uses
Is there any analogue for unix command substitution shell expansion? Like > cmd1 `cmd2
Is there a way to use unix date to print the number of seconds
Is there a standard linux/unix pattern for communicating with long running process? For example,
Is there an equivalent command on windows for the UNIX/Linux sync command? I need
Are there any alternatives to stat (which is found on most Unix systems) which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.