On Monday 19 June 2006 9:40 am, Verdi March wrote:
Hi,
Jerry Feldman wrote:
You very definitely have a memory leak. You create your list using calloc(3), but you fail to free that list.
Shouldn't that be regarded as "reachable" instead of "definite lost"? I can still refer to the allocated instances, otherwise I'd not be able to print-out the list's content.
$ ./a.out ilist: 100 500 No. That is because the pointer is available in main. If you allocate memory inside of a function, and return from that function without freeing that memory or without providing a pointer to that memory, that is unreachable. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9