|
@@ -32,6 +32,10 @@
|
|
#include <pthread.h>
|
|
#include <pthread.h>
|
|
#endif /* HAVE_LOCKS */
|
|
#endif /* HAVE_LOCKS */
|
|
|
|
|
|
|
|
+#ifdef WITH_ALLOCATOR_STATS
|
|
|
|
+#include "dmmlib/dmmlib.h"
|
|
|
|
+#endif /* WITH_ALLOCATOR_STATS */
|
|
|
|
+
|
|
/** Frees the memory block inside of a specific bitmap-organized raw block.
|
|
/** Frees the memory block inside of a specific bitmap-organized raw block.
|
|
* @param raw_block The pointer of the raw block.
|
|
* @param raw_block The pointer of the raw block.
|
|
* @param ptr The pointer of the memory block to be freed.
|
|
* @param ptr The pointer of the memory block to be freed.
|
|
@@ -62,7 +66,21 @@ void bitmap_free(raw_block_header_t *raw_block, void *ptr) {
|
|
chunk_header->requested_size);
|
|
chunk_header->requested_size);
|
|
#endif /* REQUEST_SIZE_INFO */
|
|
#endif /* REQUEST_SIZE_INFO */
|
|
|
|
|
|
-#ifdef WITH_STATS
|
|
|
|
|
|
+#ifdef WITH_ALLOCATOR_STATS
|
|
|
|
+ systemallocator.dmm_stats.total_mem_allocated -= cells_used *
|
|
|
|
+ rb_header->bytes_per_cell;
|
|
|
|
+ TRACE_1("dmmlib - global allocated memory: %zu bytes\n",
|
|
|
|
+ systemallocator.dmm_stats.total_mem_allocated);
|
|
|
|
+#ifdef REQUEST_SIZE_INFO
|
|
|
|
+ systemallocator.dmm_stats.total_mem_requested -= chunk_header->requested_size;
|
|
|
|
+ TRACE_1("dmmlib - global requested memory: %zu bytes\n",
|
|
|
|
+ systemallocator.dmm_stats.total_mem_requested);
|
|
|
|
+#endif /* REQUEST_SIZE_INFO */
|
|
|
|
+ systemallocator.dmm_stats.live_objects--;
|
|
|
|
+ systemallocator.dmm_stats.num_free++;
|
|
|
|
+#endif /* WITH_ALLOCATOR_STATS */
|
|
|
|
+
|
|
|
|
+#ifdef WITH_RAWBLOCK_STATS
|
|
raw_block->dmm_stats.total_mem_allocated -= cells_used *
|
|
raw_block->dmm_stats.total_mem_allocated -= cells_used *
|
|
rb_header->bytes_per_cell;
|
|
rb_header->bytes_per_cell;
|
|
TRACE_1("dmmlib - total allocated memory: %zu bytes\n",
|
|
TRACE_1("dmmlib - total allocated memory: %zu bytes\n",
|
|
@@ -74,7 +92,7 @@ void bitmap_free(raw_block_header_t *raw_block, void *ptr) {
|
|
#endif /* REQUEST_SIZE_INFO */
|
|
#endif /* REQUEST_SIZE_INFO */
|
|
raw_block->dmm_stats.live_objects--;
|
|
raw_block->dmm_stats.live_objects--;
|
|
raw_block->dmm_stats.num_free++;
|
|
raw_block->dmm_stats.num_free++;
|
|
-#endif /* WITH_STATS */
|
|
|
|
|
|
+#endif /* WITH_RAWBLOCK_STATS */
|
|
|
|
|
|
cell_no = ((char *)chunk_header - ((char *)rb_header + sizeof(bitmap_rb_t)))
|
|
cell_no = ((char *)chunk_header - ((char *)rb_header + sizeof(bitmap_rb_t)))
|
|
/ rb_header->bytes_per_cell;
|
|
/ rb_header->bytes_per_cell;
|