소스 검색

remove used big blocks information

Ioannis Koutras 11 년 전
부모
커밋
01079e92b5
7개의 변경된 파일0개의 추가작업 그리고 61개의 파일을 삭제
  1. 0 4
      include/dmmlib/allocator.h
  2. 0 11
      src/debug.c
  3. 0 7
      src/free.c
  4. 0 3
      src/initialize.c
  5. 0 11
      src/malloc.c
  6. 0 12
      src/memalign.c
  7. 0 13
      src/realloc.c

+ 0 - 4
include/dmmlib/allocator.h

@@ -48,10 +48,6 @@
 typedef struct allocator_s {
     /** The head of the raw blocks list. */
     struct rb_head_s rb_head;
-#ifdef WITH_DEBUG
-/** The head of the big blocks list. */
-    struct rb_head_s bb_head; 
-#endif /* WITH_DEBUG */
 #ifdef HAVE_LOCKS
 /** Mutex to allow the creation of new raw blocks. */
     pthread_mutex_t creation_mutex;

+ 0 - 11
src/debug.c

@@ -53,15 +53,4 @@ void get_raw_blocks(allocator_t *allocator) {
     }
 
     DBG_TRACE("dmmlib - there are %d raw blocks\n", counter);
-
-    counter = 0;
-
-    SLIST_FOREACH(current_raw_block, &allocator->bb_head, pointers) {
-        counter++;
-        DBG_TRACE("dmmlib - Raw block at %p of size %zu\n",
-                (void *)current_raw_block,
-                current_raw_block->size);
-    }
-
-    DBG_TRACE("dmmlib - there are %d big blocks\n", counter);
 }

+ 0 - 7
src/free.c

@@ -63,13 +63,6 @@ void free(void *ptr) {
         owner_raw_block = (raw_block_header_t *)
             ((uintptr_t) ptr - sizeof(raw_block_header_t));
 
-#ifdef WITH_DEBUG
-        LOCK_GLOBAL();
-        SLIST_REMOVE(&systemallocator.bb_head, owner_raw_block,
-                raw_block_header_s, pointers);
-        UNLOCK_GLOBAL();
-#endif /* WITH_DEBUG */
-
 #ifdef WITH_ALLOCATOR_STATS
         LOCK_GLOBAL();
         update_stats

+ 0 - 3
src/initialize.c

@@ -28,9 +28,6 @@
 /** Global variable storing allocator's settings */
 allocator_t systemallocator =
     { .rb_head = {NULL}
-#ifdef WITH_DEBUG
-    , .bb_head = {NULL}
-#endif /* WITH_DEBUG */
 #ifdef HAVE_LOCKS
     , .creation_mutex = PTHREAD_MUTEX_INITIALIZER
 #endif /* HAVE_LOCKS */

+ 0 - 11
src/malloc.c

@@ -123,17 +123,6 @@ void * malloc(size_t size) {
         ptr = create_raw_block(size + sizeof(raw_block_header_t), BIGBLOCK);
 
         if(ptr != NULL) {
-
-#ifdef WITH_DEBUG
-            /* Add the big block to a list of used big blocks */
-            LOCK_GLOBAL();
-            LOCK_RAW_BLOCK(((raw_block_header_t *)ptr));
-            SLIST_INSERT_HEAD(&systemallocator.bb_head,
-                    (raw_block_header_t *) ptr, pointers);
-            UNLOCK_RAW_BLOCK(((raw_block_header_t *)ptr));
-            UNLOCK_GLOBAL();
-#endif /* WITH_DEBUG */
-
             ptr = (void *)((uintptr_t) ptr + sizeof(raw_block_header_t));
         }
     }

+ 0 - 12
src/memalign.c

@@ -126,18 +126,6 @@ void *memalign(size_t alignment, size_t size) {
                 UNLOCK_RAW_BLOCK(aligned_header);
 #endif /* REQUEST_SIZE_INFO */
             }
-
-#ifdef WITH_DEBUG
-            LOCK_GLOBAL();
-            LOCK_RAW_BLOCK(((raw_block_header_t *) ((uintptr_t) memptr -
-                            sizeof(raw_block_header_t))));
-            SLIST_INSERT_HEAD(&systemallocator.bb_head,
-                    (raw_block_header_t *) ((uintptr_t) memptr -
-                        sizeof(raw_block_header_t)), pointers);
-            UNLOCK_RAW_BLOCK(((raw_block_header_t *) ((uintptr_t) memptr -
-                            sizeof(raw_block_header_t))));
-            UNLOCK_GLOBAL();
-#endif /* WITH_DEBUG */
         }
     }
 

+ 0 - 13
src/realloc.c

@@ -147,19 +147,6 @@ void * realloc(void *ptr, size_t size) {
                 memcpy(return_ptr, ptr,
                         owner_raw_block->size - sizeof(raw_block_header_t));
 
-#ifdef WITH_DEBUG
-                LOCK_GLOBAL();
-                LOCK_RAW_BLOCK(owner_raw_block);
-                SLIST_REMOVE(&systemallocator.bb_head, owner_raw_block,
-                        raw_block_header_s, pointers);
-                UNLOCK_RAW_BLOCK(owner_raw_block);
-                LOCK_RAW_BLOCK(new_block);
-                SLIST_INSERT_HEAD(&systemallocator.bb_head,
-                        new_block, pointers);
-                UNLOCK_RAW_BLOCK(new_block);
-                UNLOCK_GLOBAL();
-#endif /* WITH_DEBUG */
-
 #ifdef REQUEST_SIZE_INFO
                 UPDATE_GLOBAL_STATS(REALLOC_GT, size -
                         owner_raw_block->requested_size);