Browse Source

Small fixes to make freelist-organised raw blocks work

Ioannis Koutras 12 years ago
parent
commit
f5eac644f8
3 changed files with 6 additions and 3 deletions
  1. 1 1
      private-include/freelist/freelist.h
  2. 4 1
      src/debug.c
  3. 1 1
      src/freelist/freelist_malloc.c

+ 1 - 1
private-include/freelist/freelist.h

@@ -34,7 +34,7 @@
 void * freelist_malloc(raw_block_header_t *raw_block, size_t size);
 
 #ifdef FL_RB_ONLY
-#define dmmlib_free(raw_block, size) freelist_free(raw_block, size)
+#define dmmlib_free(raw_block, ptr) freelist_free(raw_block, ptr)
 #endif /* FL_RB_ONLY */
 
 void freelist_free(raw_block_header_t *raw_block, void *ptr);

+ 4 - 1
src/debug.c

@@ -54,10 +54,13 @@ void get_raw_blocks(allocator_t *allocator) {
 #ifdef FL_RB_ONLY
 
 void get_memory_blocks(raw_block_header_t *raw_block) {
+    freelist_rb_t *rb_header;
     block_header_t *memory_block;
     int counter;
 
-    memory_block = raw_block->free_list_head;
+    rb_header = (freelist_rb_t *)((char *)raw_block +
+            sizeof(raw_block_header_t));
+    memory_block = rb_header->free_list_head;
     counter = 0;
 
     while(memory_block) {

+ 1 - 1
src/freelist/freelist_malloc.c

@@ -133,8 +133,8 @@ void * freelist_malloc(raw_block_header_t *raw_block, size_t size) {
 #ifdef REQUEST_SIZE_INFO
         raw_block->dmm_stats.total_mem_requested += size;
 #endif /* REQUEST_SIZE_INFO */
-#endif /* WITH_RAWBLOCK_STATS */
     }
+#endif /* WITH_RAWBLOCK_STATS */
 
 #ifdef HAVE_LOCKS
     pthread_mutex_unlock(&raw_block->mutex);