Skip to content

Commit

Permalink
asg/mem-alloc: Remove block expansion from realloc-split-one-block
Browse files Browse the repository at this point in the history
Do not test block expansion in realloc-split-one-block.

Signed-off-by: Alex Apostolescu <[email protected]>
  • Loading branch information
Alex-deVis committed Nov 3, 2023
1 parent 68fc809 commit c5c3cc1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ os_realloc (['0', '4096'])
os_realloc (['0', '2048']) = HeapStart + 0x1f0c0
os_realloc (['0', '1024']) = HeapStart + 0x1f8e0
os_realloc (['0', '512']) = HeapStart + 0x1fd00
os_realloc (['0', '256']) = HeapStart + 0x1ff20
brk (['HeapStart + 0x20020']) = HeapStart + 0x20020
os_realloc (['HeapStart + 0x20', '0']) = 0
os_realloc (['HeapStart + 0x18060', '32798']) = HeapStart + 0x20
os_realloc (['HeapStart + 0x1c080', '16414']) = HeapStart + 0x8060
Expand All @@ -27,5 +25,4 @@ os_free (['HeapStart + 0xc0a0'])
os_free (['HeapStart + 0xe0e0']) = <void>
os_free (['HeapStart + 0xf120']) = <void>
os_free (['HeapStart + 0xf960']) = <void>
os_free (['HeapStart + 0x1ff20']) = <void>
+++ exited (status 0) +++
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

#include "test-utils.h"

#define NUM_SIZES 8

int main(void)
{
int sizes[9];
void *prealloc_ptr, *ptrs[9];
int sizes[NUM_SIZES];
void *prealloc_ptr, *ptrs[NUM_SIZES];

/* Init sizes */
for (int i = 0; i < 9; i++)
for (int i = 0; i < NUM_SIZES; i++)
sizes[i] = MMAP_THRESHOLD / (1 << (i + 1));

/* Create a free block */
Expand All @@ -17,7 +19,7 @@ int main(void)
os_free(prealloc_ptr);

/* Split the chunk multiple times */
for (int i = 0; i < 9; i++)
for (int i = 0; i < NUM_SIZES; i++)
ptrs[i] = os_realloc_checked(NULL, sizes[i]);

/* Free the first ptr and reallocate the others */
Expand All @@ -28,7 +30,7 @@ int main(void)
ptrs[i] = os_realloc_checked(ptrs[i], sizes[i-1] + 30);

/* Cleanup */
for (int i = 0; i < 9; i++)
for (int i = 0; i < NUM_SIZES; i++)
os_free(ptrs[i]);

return 0;
Expand Down

0 comments on commit c5c3cc1

Please sign in to comment.