Assignment 1 Freeing Arraylist Memory

235 views
Skip to first unread message

Hareet

unread,
Sep 19, 2020, 2:16:47 PM9/19/20
to cmpt-295-sfu
SFU ID: hareetd
Github username: hareetd
Line and file: Arraylist: main.c: lines 94 & 131
Expected behavior: No memory leaks involving arraylist.c
Observed behavior: See attached valgrindOutput image

I've already read the other threads about freeing memory in Assignment 1, however I'm still unsure of how much I can change in the Arraylist main.c file.

Am I allowed to uncomment lines 94 and 131 in main.c (see attached mainFileLines image)? That will free the arraylists created for test 0 and test 1, resolving the memory leaks involving arraylist.c and leaving only memory leaks due to a calloc call in acutest.h.
valgrindOutput.png
mainFileLines.png

kourosha...@gmail.com

unread,
Sep 20, 2020, 11:17:39 PM9/20/20
to cmpt-295-sfu
Following

Arrvindh Shriraman

unread,
Sep 21, 2020, 12:24:03 PM9/21/20
to cmpt-295-sfu
You only need to modify: 
void arraylist_free(arraylist *a)
Any leaks arising out of arraylist.c is not your responsibility.
Reply all
Reply to author
Forward
0 new messages