unix - Testing slob.c using malloc() -
i have altered slob.c gathers stats on last 100 small list allocations. made necessary edits make sure slob being used.
i running test program calls malloc() 10,000 or 100,000 times on size of 20 bytes.
but slob test results after test program runs states average claimed size 140 bytes (when expecting @ least somewhere near 20 bytes).
what doing wrong, there way accurately test slob?
i pretty sure stat collecting accurate, have had few professors check out me. current test program:
int main() { char * ; int ; for( = 0; < 1000000; i++) { = (char*) malloc(20*sizeof(char)) ; if(a == null) printf("null\n") ; } //here print system call resulting stats memory claimed , free memory
my original answer correct:
char * ; int ; for( = 0; < 10000; i++) { = (char*) malloc(20*sizeof(char)) ; if(a == null) printf("null\n") ; }
this simple code can used test how altered slob file allocates memory (considering gathering statistics within slob file).
Comments
Post a Comment