4

Memory leak in C - A few questions

view full story
linux-howto

http://www.linuxquestions.org – I'm doing some raw socket scripting in C. Everything works fine. However, I monitored the memory using top, and it shows that the memory used by my script is increasing over time. I don't have that many mallocs (maybe a couple), but lots of pointers. Even though I free those pointers (used as local variables in functions), the memory used by my program is still consuming memory (although slower than if free() is not being used). I would like to know what situations may produce memory leak and how to deal with them. Do the char[] variables need to be freed? I'm just asking for some guidelin (HowTos)