Has anybody got an idea why the area of main memory where objects are allocated is referred to as the heap. I can understand the rationale for that of the stack LIFO but would like to know what the rationale is for the 'heap' name.

  • 2
    I have zero history or evidence to back this up, but I would wager the stack came first, and in english a heap is basically the antithesis of a stack, so when something came along that wasn't a stack and had no structural guarantees, heap just came to mind for some set of people and it spread like language tends to.. Commented Feb 11, 2013 at 20:31
  • 2
    @JimmyHoffa: You're probably not far off. In the old days (which for me was circa 8086), the heap and stack grew in opposite directions towards each other, the stack growing from the bottom (end of memory) up, and the heap growing from the top (beginning of user memory) down. Commented Feb 11, 2013 at 20:37
  • 4
    @DeadMG: That's why we have this vote to close thingy, and moderator flags if you don't have enough rep to vote to close. Failing all that, you can link to a duplicate here in the comments. In any case, I did a search, and couldn't find any dupes. Commented Feb 11, 2013 at 20:45
  • 1
    To the close vote - This question is on-topic. Please see this recent Meta question for more details. Ironically, that meta question was listed in my community bulletin listing for this question.
    – user53019
    Commented Feb 11, 2013 at 20:54
  • 2
    The dup isnt on P.SE, but rather SO - stackoverflow.com/questions/660855/… and stackoverflow.com/questions/1699057/…
    – user40980
    Commented Feb 11, 2013 at 20:59

1 Answer 1


From the information found at StackOverflow - What is the origin of the term “heap” for the free store? and Why are two different concepts both called “heap”?

This information at least dates back to Knuth in 1975 referencing other (unnamed) authors:

Several authors began about 1975 to call the pool of available memory a "heap." But in the present series of books, we will use that word only in its more traditional sense related to priority queues. (The Art of Computer Programming - Fundamental Algorithms, 3rd ed., p. 435)

There is also mention of Wijngaarden discussion on Algol in the early 1970s referring to the available memory pool as a heap (heap is a reserved word in Algol which is defined in places as "allocate variable some free space from the global heap." - Algol68 dates from 1968).

Implementing the ALGOL 68 heap from 1970 may be of use in tracking down some aspects of word origin, though much if it is behind a paywall.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.