瀏覽代碼

Remove next_block from fixed / free list in case it is required during coalescing.

Ioannis Koutras 13 年之前
父節點
當前提交
843e595494
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 2 2
      src/coalesce.c
  2. 2 2
      src/custom_free.c

+ 2 - 2
src/coalesce.c

@@ -30,10 +30,10 @@ void * coalesce(allocator_t *allocator, heap_t *heap, void *ptr, size_t size) {
     prev = get_dlprevious(ptr);
 
 #ifdef WITH_FIXED_LISTS
-    // Check if it is a block of a fixed list
+    /* Check if it is a block of a fixed list */
     fixed_list_id = map_size_to_list(heap, get_size(prev));
     if(fixed_list_id != -1) {
-        // If it is, find the fixed list and remove the block
+        /* If it is, find the fixed list and remove the block */
         current_maptable_node = heap->maptable_head;
         if(fixed_list_id != 0) {
             for(i = 1; i < fixed_list_id; i++) {

+ 2 - 2
src/custom_free.c

@@ -128,7 +128,7 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
 
     if(three_blocks_size <= max_coal_size) {
         ptr = coalesce(allocator, heap, ptr, three_blocks_size);
-        // TODO Remove next_block from fixed / free list
+        remove_block_from_lists(&next_block, heap);
         coalesced = true;
         size = three_blocks_size;
     } else {
@@ -139,7 +139,7 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
         } else {
             if(current_next_size <= max_coal_size) {
                 set_size_and_free(allocator, ptr, current_next_size);
-                // TODO Remove next_block from fixed / free list
+                remove_block_from_lists(&next_block, heap);
             } else {
                 mark_free(allocator, ptr);
             }