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

  • Home
  • SEARCH
  • 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 6086775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:47:39+00:00 2026-05-23T11:47:39+00:00

Let me start by saying that I have read this tutorial and have read

  • 0

Let me start by saying that I have read this tutorial and have read this question. My questions are:

  1. How big can the stack get ? Is it
    processor/architecture/compiler
    dependent ?

  2. Is there a way to know exactly how
    much memory is available to my
    function/class stack and how much is
    currently being used in order to
    avoid overflows ?

  3. Using modern compilers (say gcc 4.5)
    on a modern computer (say 6 GB ram),
    do I need to worry for stack
    overflows or is it a thing of the
    past ?

  4. Is the actual stack memory
    physically on RAM or on CPU cache(s) ?

  5. How much faster is stack memory
    access and read compared to heap
    access and read ? I realize that
    times are PC specific, so a ratio is
    enough.

  6. I’ve read that it is not advisable
    to allocate big vars/objects on the
    stack. How much is too big ? This
    question here
    is given an answer
    of 1MB for a thread in win32. How
    about a thread in Linux amd64 ?

I apologize if those questions have been asked and answered already, any link is welcome !

  • 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-23T11:47:39+00:00Added an answer on May 23, 2026 at 11:47 am
    1. Yes, the limit on the stack size varies, but if you care you’re probably doing something wrong.
    2. Generally no you can’t get information about how much memory is available to your program. Even if you could obtain such information, it would usually be stale before you could use it.
    3. If you share access to data across threads, then yes you normally need to serialize access unless they’re strictly read-only.
    4. You can pass the address of a stack-allocated object to another thread, in which case you (again) have to serialize unless the access is strictly read-only.
    5. You can certainly overflow the stack even on a modern machine with lots of memory. The stack is often limited to only a fairly small fraction of overall memory (e.g., 4 MB).
    6. The stack is allocated as system memory, but usually used enough that at least the top page or two will typically be in the cache at any given time.
    7. Being part of the stack vs. heap makes no direct difference to access speed — the two typically reside in identical memory chips, and often even at different addresses in the same memory chip. The main difference is that the stack is normally contiguous and heavily used, do the top few pages will almost always be in the cache. Heap-based memory is typically fragmented, so there’s a much greater chance of needing data that’s not in the cache.
    8. Little has changed with respect to the maximum size of object you should allocate on the stack. Even if the stack can be larger, there’s little reason to allocate huge objects there.
    9. The primary way to avoid memory leaks in C++ is RAII (AKA SBRM, Stack-based resource management).
    10. Smart pointers are a large subject in themselves, and Boost provides several kinds. In my experience, collections make a bigger difference, but the basic idea is largely the same either way: relieve the programmer of keeping track of every circumstance when a particular object can be used or should be freed.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me start by saying that I have been reading the drag'n drop tutorial
Let me start by saying that I do not advocate this approach, but I
Let me start out by saying that I'm not a JavaScript developer so this
Let me start by saying that, Yes! I did go through Questions with similar
Let me start off by saying that I am completely new with WPF (this
Let me start by saying I've read these questions: 1 & 2 , and
First let me start by saying that I don't have a complete understanding of
Let me start by saying that this is working correctly, but I know it's
Let me start by saying I have looked at many similar questions asked, but
Let me start this off by saying that I'm an intern with no Powershell

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.