assignment 5 realloc

120 views
Skip to first unread message

M W

unread,
Nov 18, 2020, 2:40:57 PM11/18/20
to cmpt-295-sfu
SFU ID: matheww
Github username: M-max-cell
Line and file: mm_realloc.c
Expected behavior: 
Observed behavior: when I run mdriver-realloc it says my realloc did not preserve what is in the old block on line 7 of the trace file realloc-bal.rep
Question: I tried for days and I still dont know why. I think it might be a problem on lines 96-114 in mm-realloc.c. Can someone take a look? Thanks

Arrvindh Shriraman

unread,
Nov 18, 2020, 7:28:11 PM11/18/20
to cmpt-295-sfu
You may want to print out the heap word-by-word and see where the mismatch occured.
See mm_check and also read bottom of assignment 5 for checking heap consistency.

M W

unread,
Nov 18, 2020, 9:54:29 PM11/18/20
to cmpt-295-sfu
I ran into another problem with the trace file short-realloc. It outputs this message:

mdriver-realloc: mdriver-realloc.c:504: read_trace: Assertion `max_index == trace->num_ids - 1' failed.
Aborted

I have no idea what it means. I need to fix this so I can test with smaller inputs.

Arrvindh Shriraman

unread,
Nov 19, 2020, 1:27:10 PM11/19/20
to cmpt-295-sfu
Read: https://www2.cs.sfu.ca/~ashriram/Courses/CS295/hw/hw5.html : Trace_Files
That just means that the number of ops you specified is not equal to the number of alloc+realloc+free calls in your trace.
Reply all
Reply to author
Forward
0 new messages