java heap

why memory called heap?

  • Donald Knuth says (The Art of Computer Programming, Third Ed., Vol. 1, p. 435)

    Several authors began about 1975 to call the pool of available memory a “heap.”

  • ds vs. memory
    • They have the same name but they really aren’t similar (even conceptually).
    • A memory heap is called a heap in the same way you would refer to a laundry basket as a “heap of clothes”. This name is used to indicate a somewhat messy place where memory can be allocated and deallocated at will.
    • The data structure is quite different.
  • The heap is memory set aside for dynamic allocation.
    • Unlike the stack, there’s no enforced pattern to the allocation and deallocation of blocks from the heap;you can allocate a block at any time and free it at any time.
    • This makes it much more complex to keep track of which parts of the heap are allocated or free at any given time; there are many custom heap allocators available to tune heap performance for different usage patterns
Advertisements
This entry was posted in Knowledge. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s