Assignment 5 insertFreeBlock

75 views
Skip to first unread message

Jenna Liebe

unread,
Nov 24, 2020, 3:22:06 AM11/24/20
to cmpt-295-sfu
SFU ID: 301358537
Github username: jel-cmpt295
Github: Link to github repo (your assignment repos are private so these links are only accessible to TAs and Instructor): https://github.com/CMPT-295-SFU/assignment-5-jel-cmpt295
Line and file: mm.c, lines 507-608
Expected behavior: no segfault
Observed behavior: segfault
Question:
Hi,
I was using the mm_check() function to get used to how the various helper functions worked as well as test different things for mm_malloc. After calling the insertFreeBlock function though and using examine_heap, I get a segfault along with the examine_heap telling me that the size of the second block in the free list is an unrealistically large number (like 140 trillion). Am I missing a specific step that would fix this?

segfault.JPG

Jenna Liebe

unread,
Nov 24, 2020, 3:26:59 AM11/24/20
to cmpt-295-sfu
I forgot to mention that I've been running my program with ./mdriver -j in order to just run my mm_check function; that helped me focus on learning about the various functions and how stuff was being stored rather than seeing all the segfaults my mm_malloc put out every time (call to exit after running what I wanted).

ali sedaghati

unread,
Nov 24, 2020, 2:16:23 PM11/24/20
to cmpt-295-sfu
Please check how you are assigning next and prev pointers inside the insertFreeBlock. And make sure to update tag bits after this action.

ashrir...@gmail.com

unread,
Nov 24, 2020, 2:45:59 PM11/24/20
to cmpt-295-sfu
Seems to imply that you set the sizeandtags as a pointer instead of the size. See the pointer you use to dereference Sizeandtags
Reply all
Reply to author
Forward
0 new messages