13

Help regarding memory leak in this C program

view full story
linux-howto

http://www.unix.com – I have written this code in C which reads a very large collection of text files and does some processing. The problem with this code is that there are memory leaks which I am not able to figure out as to where the problem is. When I run this code, and see the memory usage using top command, then I see the memory usage keeps on increasing as the code executes and finally the program gets killed by the Linux kernel. I am pasting the code below, understanding the logic of the code is not essential but the way malloc() and free() pairs are working and also the way dynamically allocated memory loca (HowTos)