The stackoverflow.com logo suggests a certain description of a stack overflow. I don't mean to say that logos must be correct in what they depict. The logo is perfectly all right as a logo. But how apt is it as a description of the "real" stack overflow? I mean, if the stack overflow condition is detected as an error, the picture is not right. And if it is NOT detected, again the picture is not right. Is what I say correct?

  • Other than the colors and the meaningless font change, it's an excellent logo. Nov 16, 2008 at 16:26
  • Font strength change, I mean. Nov 16, 2008 at 16:27
  • From the original question: The logo is perfectly all right as a logo.
    – Aydya
    Nov 16, 2008 at 17:07
  • 1
    Can someone mark this as community wiki please!
    – questzen
    Nov 16, 2008 at 17:36

12 Answers 12


About the logo itself:

The logo itself is like a real stack overflow in some ways and not in others.

  • The colors going from gray to orange maybe signifies danger in the logo as you go higher in the stack, a better representation for a stack overflow though, would be to have all elements completely gray until it reached the maximum size, and then it would turn red for everything above it.
  • The logo correctly shows that the elements of the stack are exceeding the stack limit.
  • Usually your program will crash or you will get a segmentation fault as soon as you exceed your stack. In this way the logo is not like a real stack overflow. Because it shows many items on top of the stack.

The logo properly displays that it is a stack:

  • The logo has a container for the elements in the stack
  • The logo shows that there are elements in the stack.
  • The logo shows that the bottom of the stack is closed, meaning things enter it first in last out.

About what a stack overflow is:

A stack has a maximum address that should not be exceeded. This maximum address can be exceeded by pushing something onto the stack. The size of the stack determines what this maximum address can be. You can set this stack size for your programs.

As an aside, the opposite is a stack underflow, where you try to pop from the stack when nothing is on it, resuling in going under the minimum address that cannot be exceeded.

Here is an example of a stack overflow:

int functionCall()
   char x[102400000]; // <--- Just an example, may not overflow if stack is very large
   return 0;

Here is another example of a stack overflow, In this example the stack is exceeded because every function call pushes something on the stack:

void MyRecursiveFunction()
  • 5
    I love that a real stack would be grey and then turn red when it overflows. However I respectfully submit a stack is normally a sort of pale green.
    – mackenir
    Nov 16, 2008 at 16:53
  • 2
    I just noticed, you wrote that big answer in 4 minutes. Very impressive.
    – mackenir
    Nov 16, 2008 at 16:57
  • I fixed the wording now by the way so that it doesn't say what color a real stack is :) Nov 16, 2008 at 16:59
  • ...and now my smartass comment doesnt make as much sense. Tsk.
    – mackenir
    Nov 16, 2008 at 17:03
  • But luckily there is a comment trail. Nov 16, 2008 at 17:05
  • In your first example, "char x[102400000];" may be compiler optimized to the heap since the program exits when main does and while scoped locally, it may as well be global for the length of time it's occupied. You might move it to a function call to be more explicit.
    – Pollyanna
    Nov 18, 2008 at 16:09
  • Changed to function call. Nov 19, 2008 at 0:32
  • 2
    Nitpick time!! On Windows, at least, extra stack space is provided after a stack overflow, so that the resulting exception can be handled with code that needs the stack. In this light, the logo is still somewhat accurate, because the items beyond the top of the stack are representative of this extra buffer reserved for exception handling purposes. Nov 10, 2009 at 3:41
  • 10MB of stack space? What kind of idiot does that??
    – Cole Tobin
    Aug 18, 2012 at 23:24

It's just a logo, and you are all crazy people.

For the humour-impaired, ;), but also, come on... :|.

  • I concur! :-Þ Logos are an artistic expression. Analyzing such things pedantically is the path to craziness!
    – Chris
    Nov 16, 2008 at 18:58
  • 1
    and it was designed by a designer, not necessarily a programmer (apologies if the designer is a programmer :P)
    – hasen
    May 25, 2009 at 1:57

What is a stack overflow?

Well my friends, years ago, back in the dark ages of computing, a colleague came to me with a problem. His code was randomly crashing, and he couldn't figure out where the bug was.

By crash I mean write random characters to random spots on the screen, lock up, and require physical powering down. Yes, this was the world of DOS, the IBM pc, back when we ran without virtual memory or "protected" memory segments.

So it turns out my colleague was running with the default 4k stack. Yes, 4 kilobytes. Get out your magnifying glass.

Back in those days, the stack started at one end of memory. Code went at another. Heap went at another. The heap and stack kind-of worked up/down toward each other. When they met, it was "troublesome".

Only my colleague's compiler put his compiled binary code up at the end of the stack.

And he declared a large array of floats on the stack. A very large array, for his stack size. It took up a little over 3k.

Eventually, when his function call tree got deep enough, he overwrote his code.

Eventually, he called that code.

My friends, THAT is a stack overflow.

You people today, with your virtual memory and coredumps. You have it easy!

  • Amen! (15 characters? I thought this limit was supposed to be going down...) Nov 10, 2009 at 3:40

Generally a stack is a Last In - First Out (FIFO) structure. In most systems the storage allocated to the stack is finite in nature. A common way is to segment the address space such that the heap grows from one end address space and the stack from the other end. when the number of elements in the stack exceed the storage space it is said to overflow.

There are CPU stacks keeping track of various values, there are stack frames for tracking function calls in a language run-time and various other stacks keeping track of temporary values. the reason the stack is used is because allocating memory on the stack really just copying a value and incrementing a pointer just past the size of the pushed element.

  • A stack is First In Last Out (FILO) not FIFO.
    – Jeff Yates
    Nov 16, 2008 at 16:37
  • heaps don't grow towards the stack.. the heap is for dynamically-allocated items, and the stack is for stuff used in function calls (including local variables)
    – warren
    Nov 16, 2008 at 16:40
  • warre, i have to agree with him here. every sbrk system syscall will make the heap grow a bit more towards the stack. Nov 16, 2008 at 16:50
  • @warren, heaps grow towards the stack on most systems. Nov 16, 2008 at 16:50
  • @MikeJ, everything you said looks good except for the FIFO part, correct this part and I'll up vote you. Nov 16, 2008 at 16:51
  • yes, i agree Robert. i will do the same Nov 16, 2008 at 16:52
  • <strike>they're too mean here. this is a correct description of whatmakes a stackoverflow bad for the program. but they still vote this down even after he corrected the FIFO error.</strike> I see now the correction was done by someone else :) Nov 16, 2008 at 17:52
  • Warren, the use of a heap growing toward the stack, or even having two stacks that grow toward each other inside of a large memory segment is not an uncommon implementation, especially when stacks were implemented entirely in software.
    – orcmid
    Nov 17, 2008 at 2:17
  • And Warren, it is useful for the area that is used for heap blocks to grow towards an approaching stack. Sometimes this involves reorganization of the heap from time to time so that any holes are moved to the space in front of the approaching stack. Or, depending on situation, fail on collision.
    – orcmid
    Nov 17, 2008 at 2:21

The meaning "stack overflow" becomes apparent from the logo if you think at "stack" and "overflow" with the common, dictionary meaning in mind instead of the CS meaning.

Think of a pile of cookies that overflows from a cup...

  • I think as a depiction of cookies overflowing from a cup it is definitely misleading
    – Aydya
    Nov 16, 2008 at 17:10
  • Well, it's just a logo, no? It's difficult to depict an exceptional condition in a technical setting, like an overflow of the stack of a process, with a simple picture. It doesn't mean to be accurate. The very name of this site is also symbolic: SO deals with programming, not with flaws like s.o.'s
    – Federico Ramponi
    Nov 16, 2008 at 18:28

I don't know how to compare the logo to a real stack overflow. Strictly speaking, a stack overflow could apply to any kind of stack, not just the function call stack that the two existing answers refer to. As they describe, a stack overflow happens when a stack has more things pushed onto it than its fixed allocation of memory can accommodate. In that sense, the logo is completely wrong because the items wouldn't curve as they overflowed, nor would they change color, because they wouldn't have a geometric orientation or a color to begin with.

In any case, I always thought the stackoverflow.com name referred more to the problem of developers being overwhelmed with things to do, things to learn, and in general, too many mental contexts over the course of a day. In that sense, there's nothing technical about the name at all...


For a technical description of a stack overflow see How does a "stack overflow" occur and how do you prevent it?

The logo does not accurately depict a computational stack overflow, but it gives a sense of the words "stack" and "overflow." As a logo goes it's great, for several reasons:

  1. It's easy to recognize, so branding is solid.
  2. It depicts the name, and thus the association is reasonably solid in a user's mind.
  3. It's easy/cheap to render in color, black and white, and low and high resolution devices. (ie, no information is lost when the logo is monotone or grayscale)
  4. Compression works well on it, so it's cheap to transmit, store, cache, buffer, render, etc

As far as technical issues:

  • A stack overflow results in other memory being overwritten - the logo suggests that the container just stops accepting new items, and they are lost. The reality is much more insidious in nature - the new items are destructive to existing data near the memory location of the stack. Think of a stack as containing antimatter, and the rest of the program consisting of matter. When the stack overflows, it 'spills' onto the rest of the program and Bad Things Happen (TM).
  • A stack, in most architectures, grows downward from the top - the memory location of the stack generally starts at a higher address, say 0xFFFF and the stack pointer decrements down to 0x0000 (the heap grows up, in this way there's a buffer in between so that stack or heap overflows have less impact), so visually the logo is upside down. Unless, of course, you look at memory as a list starting with 0x0000, where it would appear that a stack "grows upward by decreasing its memory pointer":
    • 0x0000
    • 0x0001
    • ...
    • 0xFFFE
    • 0xFFFF
    • This is, of course, a matter of perspective, and results in much confusion. In general one should refer to a stack as "decrementing" or "incrementing" to avoid such confusion.
  • The logo depicts a stack of even sized items. Stacks can (and do) hold all sorts of oddly sized and shaped things - there is no constant typical item size.

But, at the end of the day, a logo is about branding. It's not meant to be a teaching object, and this one is very good for it's purpose.



Unfortunately, the logo, in all its beauty, does not suggest the undesirability of the stack overflow condition. It looks inviting!

  • 3
    Well. They do want people to use the site, not run away screaming...
    – Jeff Davis
    Sep 9, 2009 at 20:17

A stack overflow occurs when the pile of papers to be handled in your inbox gets so high that it cascades sideways onto the floor, causing a complete brain reset in panic at dealing with so many issues.

The friction of the paper sliding sideways causes it to burst into flames, thus the change in color to a fiery orange as the stack gets higher and higher.


Technically, for a call stack a "stack overflow" is detected when the CPU issues a write to the stack at a higher address than "allowed", which leads to an exception being raised to the operating system. The range of "allowed" addresses is determined by the memory tables for that process and is set up by the operating system. When creating a thread in windows, you can decide what size the stack should have. (Even though, the physical memory is probably not committed to this stack until actually required.)

  • "an exception being raised to the operating system" assuming a protected operating system. On some systems, you'll just keep merrily onward, having corrupted some kernel structure, or another thread's stack, or whatever.
    – onebyone
    Nov 16, 2008 at 16:27
  • 1
    On most CPUs, a stack actually grows down, from higher addresses to lower. This seems counter-intuitive, but made a lot of sense back in the days when the stack, data, & code often shared the same address space. Data could grow up & the stack could grow down. An overflow meant overwriting data.
    – P Daddy
    Nov 16, 2008 at 17:58

I agree with Federico about the common use of the term.

Thinking further back, consider a cafeteria line that has a special stacker for clean trays at the start of the line. The stack has a spring mechanism so that the stack will sink into the container as more clean trays are placed on top.

At some point, the stack can't descend any farther and new trays will start to pile up higher and higher above the normal height maintained by the stacking mechanism. Keep this up and the stack will be unstable and topple.

This is not unlike the stack used diagramatically in the Stack Overflow logo.

There is another case too, referred to as stacker or hopper overflow.

In the era of punched cards, card readers and card punches attached to computers would often stack their output face down where it could be removed from the output hopper with the cards in proper sequence. The stack of output or already-read cards was usually fed onto a spring-loaded piston under a plate that could move up and down inside of a channel that kept the cards from falling out. (You could remove the cards sideways from the vertical hopper.)

When it was sensed that the plate had descended too far, there was a mechanical mechanism (patented by IBM) involving a spring-loaded toggle switch. When the toggle was thrown by the weight of the descending stack of cards, the card transport would be stopped until an operator removed the stack from the hopper that overflowed.


Thanks for informative answers, incisive comments and eloquent markdowns. I clarify again: the logo is good enough as a logo. My question was only about whether it depicted the stack overflow condition properly.

I appreciate the historical(nostalgic for me too) references to the various connotations of stack.

You must log in to answer this question.