CMPSC 16 Lecture Notes - Lecture 12: Valgrind, Memory Leak, A.Out
Document Summary
Arrays, pointers, references, dynamic memory (new and delete) Node *p = head; //head is a pointer. The pointer is pointing to the address stored in head, which is the 1st value of the node/struct. P->next; //a way to access the memory address of the next node. A memory leak can still occur if the nodes are not deleted. Memory leak occurs when something is created on the heap but never removed. Run through valgrind to check if there are memory leaks. Compile with the -g option first: g++ -g file. cpp. Valgrind needs to be installed; already assigned on the csil machines.