I have a process which continuously allocates memory and will free it after another thread have processed related data. When the data processing rate is slow, I see RES memory grows up; but after all the data have been processed, RES goes down but doesn't go back to original RES value (even after waiting for over 10 minutes).
e.g. 10 MB (original) => 50 MB (peak) => 30MB (after all data are freed)
I have used valgrind with massif to profile memory, it looks like all data are freed. My question is why RES doesn't go back to original 10 MB?