|
@@ -26,15 +26,17 @@ void split(allocator_t *allocator, heap_t *heap, void *ptr,
|
|
size_t min_split_size;
|
|
size_t min_split_size;
|
|
void *new_block;
|
|
void *new_block;
|
|
size_t new_block_size;
|
|
size_t new_block_size;
|
|
|
|
+#ifdef WITH_FIXED_LISTS
|
|
|
|
+ int fixed_list_id, i;
|
|
|
|
+ maptable_node_t *current_maptable_node;
|
|
|
|
+#endif /* WITH_FIXED_LISTS */
|
|
#ifdef COALESCE_AFTER_SPLIT
|
|
#ifdef COALESCE_AFTER_SPLIT
|
|
size_t max_coal_size;
|
|
size_t max_coal_size;
|
|
void *next_block;
|
|
void *next_block;
|
|
size_t current_next_size;
|
|
size_t current_next_size;
|
|
|
|
+
|
|
|
|
+ next_block = get_dlnext(allocator, ptr);
|
|
#endif /* COALESCE_AFTER_SPLIT */
|
|
#endif /* COALESCE_AFTER_SPLIT */
|
|
-#ifdef WITH_FIXED_LISTS
|
|
|
|
- int fixed_list_id, i;
|
|
|
|
- maptable_node_t *current_maptable_node;
|
|
|
|
-#endif /* WITH_FIXED_LISTS */
|
|
|
|
|
|
|
|
/* Check what would be the size of the new block if we split the current
|
|
/* Check what would be the size of the new block if we split the current
|
|
* one.
|
|
* one.
|
|
@@ -61,6 +63,10 @@ void split(allocator_t *allocator, heap_t *heap, void *ptr,
|
|
new_block = (void *)((char *)ptr + req_size + HEADER_SIZE);
|
|
new_block = (void *)((char *)ptr + req_size + HEADER_SIZE);
|
|
new_block_size = get_size(ptr) - req_size - HEADER_SIZE;
|
|
new_block_size = get_size(ptr) - req_size - HEADER_SIZE;
|
|
|
|
|
|
|
|
+ if(allocator->border_ptr == ptr) {
|
|
|
|
+ allocator->border_ptr = new_block;
|
|
|
|
+ }
|
|
|
|
+
|
|
/* Resize the previous, to be used block */
|
|
/* Resize the previous, to be used block */
|
|
set_size_and_used(allocator, ptr, req_size);
|
|
set_size_and_used(allocator, ptr, req_size);
|
|
|
|
|
|
@@ -73,7 +79,6 @@ void split(allocator_t *allocator, heap_t *heap, void *ptr,
|
|
max_coal_size = heap->dmm_knobs.max_coalesce_size;
|
|
max_coal_size = heap->dmm_knobs.max_coalesce_size;
|
|
#endif /* COALESCING_VARIABLE */
|
|
#endif /* COALESCING_VARIABLE */
|
|
|
|
|
|
- next_block = get_dlnext(allocator, ptr);
|
|
|
|
if(next_block != NULL) {
|
|
if(next_block != NULL) {
|
|
if(is_free(next_block) == true) {
|
|
if(is_free(next_block) == true) {
|
|
#ifdef WITH_OWNERSHIP
|
|
#ifdef WITH_OWNERSHIP
|
|
@@ -100,7 +105,6 @@ void split(allocator_t *allocator, heap_t *heap, void *ptr,
|
|
#endif /* COALESCE_AFTER_SPLIT */
|
|
#endif /* COALESCE_AFTER_SPLIT */
|
|
|
|
|
|
set_size_and_free(allocator, new_block, new_block_size);
|
|
set_size_and_free(allocator, new_block, new_block_size);
|
|
- set_previous_size_availability(new_block, get_size_availability(ptr));
|
|
|
|
|
|
|
|
#ifdef WITH_FIXED_LISTS
|
|
#ifdef WITH_FIXED_LISTS
|
|
/* FIXME code from custom_free, some refactoring maybe?
|
|
/* FIXME code from custom_free, some refactoring maybe?
|
|
@@ -154,8 +158,4 @@ void split(allocator_t *allocator, heap_t *heap, void *ptr,
|
|
set_owner(new_block, heap);
|
|
set_owner(new_block, heap);
|
|
#endif /* WITH_OWNERSHIP */
|
|
#endif /* WITH_OWNERSHIP */
|
|
|
|
|
|
- if(allocator->border_ptr == ptr) {
|
|
|
|
- allocator->border_ptr = new_block;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|