|
@@ -16,7 +16,6 @@
|
|
|
*/
|
|
|
|
|
|
#include <dmmlib/dmmlib.h>
|
|
|
-#include "dmm_config.h"
|
|
|
#include "other.h"
|
|
|
#ifdef HAVE_LOCKS
|
|
|
#include "posix_lock.h"
|
|
@@ -24,15 +23,17 @@
|
|
|
#if defined (COALESCING_FIXED) || defined (COALESCING_VARIABLE)
|
|
|
#include "coalesce.h"
|
|
|
#endif /* COALESCING_FIXED || COALESCING_VARIABLE */
|
|
|
-#ifdef WITH_KNOBS
|
|
|
+#ifdef WITH_ADAPTIVITY
|
|
|
#include "dmm_adaptor.h"
|
|
|
-#endif /* WITH_KNOBS */
|
|
|
+#endif /* WITH_ADAPTIVITY */
|
|
|
#include "block_header.h"
|
|
|
|
|
|
void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
|
|
|
size_t size;
|
|
|
+#ifdef WITH_FIXED_LISTS
|
|
|
int fixed_list_id, i;
|
|
|
maptable_node_t *current_maptable_node;
|
|
|
+#endif /* WITH_FIXED_LISTS */
|
|
|
#if defined (COALESCING_FIXED) || defined (COALESCING_VARIABLE)
|
|
|
bool coalesced;
|
|
|
size_t max_coal_size;
|
|
@@ -88,6 +89,7 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
|
|
|
}
|
|
|
#endif /* COALESCING_FIXED || COALESCING_VARIABLE */
|
|
|
|
|
|
+#ifdef WITH_FIXED_LISTS
|
|
|
/* Check if the block could be put in a fixed list */
|
|
|
fixed_list_id = map_size_to_list(heap, size);
|
|
|
|
|
@@ -100,6 +102,7 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
|
|
|
}
|
|
|
push_block(ptr, current_maptable_node->fixed_list_head);
|
|
|
} else { /* put it in the free list */
|
|
|
+#endif /* WITH_FIXED_LISTS */
|
|
|
#if defined (COALESCING_FIXED) || defined (COALESCING_VARIABLE)
|
|
|
/* The block should be added to the free list only if it is not
|
|
|
* coalesced
|
|
@@ -110,7 +113,9 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
|
|
|
#else
|
|
|
push_block(ptr, heap->free_list_head);
|
|
|
#endif /* COALESCING_FIXED || COALESCING_VARIABLE */
|
|
|
+#ifdef WITH_FIXED_LISTS
|
|
|
}
|
|
|
+#endif /* WITH_FIXED_LISTS */
|
|
|
|
|
|
/* Update Stats */
|
|
|
heap->dmm_stats.live_objects -= 1;
|
|
@@ -118,7 +123,7 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
|
|
|
|
|
|
/* End of Stats */
|
|
|
|
|
|
-#ifdef WITH_KNOBS
|
|
|
+#ifdef WITH_ADAPTIVITY
|
|
|
/* Refresh the state of the heap allocator if a certain number of
|
|
|
* free's has been served already
|
|
|
*/
|
|
@@ -126,7 +131,7 @@ void custom_ahfree(allocator_t *allocator, heap_t* heap, void *ptr) {
|
|
|
if(heap->dmm_stats.num_free % 100) {
|
|
|
free_state_refresh(heap);
|
|
|
}
|
|
|
-#endif /* WITH_KNOBS */
|
|
|
+#endif /* WITH_ADAPTIVITY */
|
|
|
|
|
|
#ifdef HAVE_LOCKS
|
|
|
posix_unlock(heap);
|