Yeah this is kind of what I was getting as well when I was running Malloc implementations I could get addresses and for the most part it seemed that the malloc allocations the size would be a contiguous range of virtual memory for each malloc but the space between each malloc was vastly different. As for the goal of the benchmark it was looking at different implementations of malloc such as stdlib.h malloc, tcmalloc, and mimalloc... seeing if there was a difference in space efficiency of these approaches. I was pretty sure that maybe what I was looking for was unfeasible or at least from the way I was approaching it this post was mostly me trying to see if I was missing something.
Here is a snippet of how the test looked where report memory would check to see if there was a bounds violation and then turn on a flag i had
while (1) {
//here would be like where I would replace the implementation
int *ptr = (int *)malloc(size);
// i read somewhere that sometimes this will get put off somewhere if i did not actively allocate it so i did this to be safe
for (int i = 0; i < size / sizeof(int); i++) {
ptr[i] = i;
fprintf(fptr2,"J%d:%p\n",i,&ptr[i]);
}
/*report memory checks if the amount of memory allocations
has reached a limit of memory the process could have or violate the bound */
report_memory();
if(flag==1){
break;
}
// Log successful allocation
fprintf(fptr, "%zu\n", allocation_count);
allocation_count++;
}