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 rough equivalent to the Linux/Unix stdio.h popen() function in the Win32
I always use unix timestamps for everything, but am wondering if there is a
Is there a Windows equivalent of the Unix command, nice ? I'm specifically looking
Is there a way to emulate the unix cut command on windows XP, without
Is there a good command-line UNIX charting / graphing / plotting tool out there?
Is there a lightweight process execution timer like Unix's time included with Windows? Sometimes
Is there any Visual Studio add-on (or windows/unix stand-alone program) that creates stub implementations
Is there a way to log(/var/log) commands executed by users in the Unix shell?
What methods are there for automatically getting a stack trace on Unix systems? I
I realize that since UNIX sockets are platform-specific, there has to be some non-Java

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.