I know this is hardly a new question, but I haven’t found anything elsewhere that works.
I’ve got a C program that steadily eats memory as it runs – I use the ‘free’ command to track it, and I can see the amount of available memory is decreasing as long as it executes, which shouldn’t be happening. However, I can’t find anything in the program itself that could be causing this. I’ve also tested it with valgrind and dmalloc, and nether of them are able to detect any memory loss.
How do I find the leak?
If you’re sure about your usage of memory, perhaps it’s not your mallocs and frees that are the problem.
If you’re using any libs, you should double-check that you use them correctly. Many have initialisation and freeing functions that you can easily forget, and thus cause memory leak(s).