|
@@ -97,21 +97,31 @@ void * realloc(void *ptr, size_t size) {
|
|
|
#endif /* REQUEST_SIZE_INFO */
|
|
|
|
|
|
LOCK_RAW_BLOCK(owner_raw_block);
|
|
|
- owner_raw_block->size = full_size;
|
|
|
#ifdef REQUEST_SIZE_INFO
|
|
|
owner_raw_block->requested_size = size;
|
|
|
#endif /* REQUEST_SIZE_INFO */
|
|
|
UNLOCK_RAW_BLOCK(owner_raw_block);
|
|
|
|
|
|
+ // FIXME This is pagesize and mmap-specific
|
|
|
+#ifdef PAGESIZE_ALIGN
|
|
|
+ if(remaining_size > pagesize) {
|
|
|
+ remaining_size = pagesize * ((remaining_size + pagesize - 1) /
|
|
|
+ pagesize);
|
|
|
+
|
|
|
+ LOCK_RAW_BLOCK(owner_raw_block);
|
|
|
+ owner_raw_block->size = full_size;
|
|
|
+ UNLOCK_RAW_BLOCK(owner_raw_block);
|
|
|
+
|
|
|
#ifdef WITH_ALLOCATOR_STATS
|
|
|
- LOCK_GLOBAL();
|
|
|
- systemallocator.dmm_stats.total_mem_allocated -= remaining_size;
|
|
|
- UNLOCK_GLOBAL();
|
|
|
+ LOCK_GLOBAL();
|
|
|
+ systemallocator.dmm_stats.total_mem_allocated -= remaining_size;
|
|
|
+ UNLOCK_GLOBAL();
|
|
|
#endif /* WITH_ALLOCATOR_STATS */
|
|
|
|
|
|
- // FIXME This is mmap-specific
|
|
|
- munmap((void *)((uintptr_t) owner_raw_block +
|
|
|
- owner_raw_block->size), remaining_size);
|
|
|
+ munmap((void *)((uintptr_t) owner_raw_block +
|
|
|
+ owner_raw_block->size), remaining_size);
|
|
|
+ }
|
|
|
+#endif /* PAGESIZE_ALIGN */
|
|
|
|
|
|
return_ptr = ptr;
|
|
|
|