| Revision 490,
1.1 KB
checked in by wd, 8 years ago
(diff) |
|
Add Id/Rev? keywords.
|
-
Property svn:keywords set to
Id Rev
|
| Line | |
|---|
| 1 | ############################################################################### |
|---|
| 2 | # |
|---|
| 3 | # heaps.txt: documentation of the blockheap allocator. |
|---|
| 4 | # |
|---|
| 5 | # Copyright 2002 the Ithildin Project. |
|---|
| 6 | # See the COPYING file for more information on licensing and use. |
|---|
| 7 | # |
|---|
| 8 | # $Id$ |
|---|
| 9 | # |
|---|
| 10 | ############################################################################### |
|---|
| 11 | |
|---|
| 12 | A simple description of the heap-allocation system: |
|---|
| 13 | |
|---|
| 14 | The heap allocator is a simple mechanism to prevent the cycle of malloc/free |
|---|
| 15 | which often occurs when allocating items of the same size. With a heap |
|---|
| 16 | allocator, several items are allocated at once, and instead of returning the |
|---|
| 17 | memory to the system, the memory is instead simply kept to be re-allocated |
|---|
| 18 | later. The system assumes that a lot of allocation and de-allocation will |
|---|
| 19 | occur at once. |
|---|
| 20 | |
|---|
| 21 | The system uses a small/simple singly linked list within each heap to |
|---|
| 22 | specify free memory. The list takes up no additional memory, because the |
|---|
| 23 | pointers are simply placed at the beginning of a free block in the heap, |
|---|
| 24 | using the memory already allocated. The list head does, of course, takes |
|---|
| 25 | memory. For more gory details, check out the actual code. |
|---|
| 26 | |
|---|
| 27 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.