Changeset 588 for soft/giet_vm/giet_libs/malloc.h
- Timestamp:
- Jul 8, 2015, 3:40:18 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_libs/malloc.h
r550 r588 14 14 // to MIN_BLOCK_SIZE (typically 128 bytes). 15 15 // - All free blocks are aligned. 16 // - They are pre-classed in NB_SIZES linked lists, where all blocks in the17 // samelist have the same size.16 // - They are pre-classed in NB_SIZES linked lists, where all blocks in a 17 // given list have the same size. 18 18 // - The NEXT pointer implementing those linked lists is written 19 19 // in the 4 first bytes of the block itself, using the unsigned int type. … … 40 40 // - This allocation policy has the nice following property: 41 41 // If the heap segment is aligned (the heap_base is a multiple of the 42 // heap_ base), all allocated blocks are aligned on the actual_size.42 // heap_size), all allocated blocks are aligned on the actual_size. 43 43 //////////////////////////////////////////////////////////////////////////////// 44 44 // Free policy: … … 52 52 // - The index in this array is computed from the allocated block base address: 53 53 // index = (block_base - heap_base) / MIN_BLOCK_SIZE 54 // - The alloc ated[] array is stored at the end of heap segment. This consume54 // - The alloc[] array is stored at the end of heap segment. This consume 55 55 // (1 / MIN_BLOCK_SIZE) of the total heap storage capacity. 56 56 //////////////////////////////////////////////////////////////////////////////// … … 73 73 // heap(x,y) descriptor (one per cluster) 74 74 //////////////////////////////////////////////////////////////////////////////// 75 75 76 typedef struct giet_heap_s 76 77 { 78 user_lock_t lock; // lock protecting exclusive access 77 79 unsigned int init; // initialised <=> value == HEAP_INITIALIZED 78 80 unsigned int x; // cluster X coordinate … … 82 84 unsigned int alloc_base; // alloc[] array base address 83 85 unsigned int alloc_size; // alloc[] array size (bytes) 84 user_lock_t lock; // lock protecting exclusive access85 86 unsigned int free[32]; // array of base addresses of free blocks 86 87 // (address of first block of a given size)
Note: See TracChangeset
for help on using the changeset viewer.