views:

252

answers:

1

I've got a memory leak somewhere, but it doesn't appear to be related to my program. I'm making this bold statement based on the fact that once my program terminates, either by normal means, seg-faulting, or aborting, the memory isn't recovered. If my program were the culprit, I would assume the MMU would recover everything, but this doesn't appear to be the case.

The leak only comes into play when I redirect stdout (in BASH version 2.05 or 4) to a file, as in this is okay:

# my-program

but this isn't:

# my-program > /mnt/sda1/log-output.txt

The rate at which I'm printing to the screen is < 2Kb/sec. (The file is on a USB key).

Any ideas?

A related question is here.

+1  A: 

The MemFree alone says nearly nothing.

Linux's block layer caches a lot.

You can see how much is being used for filesystem (and other) caches in the same /proc/meminfo you have mentioned.

EFraim
Alllll righty then! I looked at the other fields in the /proc/meminfo and saw that the "Active:" and "Cached:" fields climb significantly. I probably don't have memory leak.
Jamie