|
@@ -47,9 +47,15 @@ void initialize_allocator(allocator_t *allocator) {
|
|
|
|
|
|
for(i = 0; i < NUM_HEAPS; i++) {
|
|
|
#ifdef HEAP_VAR_FIT
|
|
|
- if(INITIAL_SEARCH_POLICY == "best") {
|
|
|
- allocator->heaps[i].search_policy = &best_fit_on_freelist;
|
|
|
- }
|
|
|
+ if(strcmp(INITIAL_SEARCH_POLICY, "best") == 0) {
|
|
|
+ allocator->heaps[i].dmm_knobs.search_policy = &best_fit_on_freelist;
|
|
|
+ } else if(strcmp(INITIAL_SEARCH_POLICY, "good") == 0) {
|
|
|
+ allocator->heaps[i].dmm_knobs.search_policy = &good_fit_on_freelist;
|
|
|
+ } else if(strcmp(INITIAL_SEARCH_POLICY, "exact") == 0) {
|
|
|
+ allocator->heaps[i].dmm_knobs.search_policy = &exact_fit_on_freelist;
|
|
|
+ } else if(strcmp(INITIAL_SEARCH_POLICY, "first") == 0) {
|
|
|
+ allocator->heaps[i].dmm_knobs.search_policy = &first_fit_on_freelist;
|
|
|
+ }
|
|
|
#endif /* HEAP_VAR_FIT */
|
|
|
#ifdef WITH_FIXED_LISTS
|
|
|
allocator->heaps[i].maptable_head = NULL;
|
|
@@ -108,6 +114,12 @@ void initialize_allocator(allocator_t *allocator) {
|
|
|
#ifdef ALLOC_VAR_FIT
|
|
|
if(strcmp(INITIAL_SEARCH_POLICY, "best") == 0) {
|
|
|
allocator->search_policy = &best_fit_on_freelist;
|
|
|
+ } else if(strcmp(INITIAL_SEARCH_POLICY, "good") == 0) {
|
|
|
+ allocator->search_policy = &good_fit_on_freelist;
|
|
|
+ } else if(strcmp(INITIAL_SEARCH_POLICY, "exact") == 0) {
|
|
|
+ allocator->search_policy = &exact_fit_on_freelist;
|
|
|
+ } else if(strcmp(INITIAL_SEARCH_POLICY, "first") == 0) {
|
|
|
+ allocator->search_policy = &first_fit_on_freelist;
|
|
|
}
|
|
|
#endif /* ALLOC_VAR_FIT */
|
|
|
|