Assignment 1 - Part 1 and 2 (memory leak and build-tree)

143 views
Skip to first unread message

kourosha...@gmail.com

unread,
Sep 23, 2020, 4:07:44 AM9/23/20
to cmpt-295-sfu

Assignment 1 - Part 1
SFU ID: kazizi
Github username: kazizi-dev
Line and file: lines 13 and 22 in attached log file
Question: I was wondering if the memory leak summary in lines 21and 59 in the attached log file are related to my code or is the memory leak as a result of acutest.h file?

Additional info:
Please see the attached log file from the result of this command:
$ valgrind --leak-check=full --show-leak-kinds=all ./arraylist.bin

Line 21: ==2089==    by 0x10956F: arraylist_add (arraylist.c:27)
  • At arraylist.c:27, I'm using realloc().
Line 49: ==2090==    by 0x109610: arraylist_insert (arraylist.c:44)
  • At arraylist.c:44, I'm using memmove().

Assignment 1 - Part 2
Line and file: lines 59, tree.c
Expected behavior: build tree
Observed behavior: build tree
Question: I have added a helper function to avoid using pre_right parameter because I found pre_left to be enough to implement the algorithm. The test cases all pass, is this acceptable?
arraylist_log.txt

Arrvindh Shriraman

unread,
Sep 23, 2020, 12:19:10 PM9/23/20
to cmpt-295-sfu
Your code is leaky.
As the report says leak is in arraylist.c

kourosha...@gmail.com

unread,
Sep 23, 2020, 7:17:22 PM9/23/20
to cmpt-295-sfu
Could you please provide some insights on what I might be doing wrong for realloc and memmove? I have added some error handling for realloc, but it didn't make any difference in the memory leak summary.
Reply all
Reply to author
Forward
0 new messages