OK, before you mark my thread a duplicate I want to say, that I know this very good answer: How do I clean or disable the memory cache?
But this is not case for me.
I am making some performance tests between in-memory application and disk-using application. So I want to have guarantee, that every time application tries to fetch something from disk, system really fetches this from disk, not from memory cache. (I want to have performance factor, by how much worse application operates, when it has to read from disk.)
I know, that I can clean cache by sync && echo 3 > /proc/sys/vm/drop_caches
command, but cleaning every minute by cron is to slow for me, because cache is getting filled very quickly again.
So I have a question: Can't you really disable this feature? Or maybe go around it? It really can mess up my tests results.
PS: I am using Ubuntu 12.04 64-bit.
mmap()
magic that makes the map to the disk volatile and so forcing a rewrite/reread every time, but I suspect that caching the filesystem content is so tied to the basic memory manager that it is impossible to avoid it. I can be wrong --- will see.