Is there a way to programatically clear the buffer cache on the Mac, preferrably in C?
Basically, I\'m looking for the equivalent of the source of 10.5 (and greater)
Wouldn't you be interested in turning off the cache for a file instead? Depending on what you are trying to achieve, it could be an alternative. Good summary here.
UBC can be cleared by running 'purge' which allocates a lot of memory to force the cache to clear.
fcntl(fd, F_GLOBAL_NOCACHE, 1)
can be used turn caching off for a particular file. This can be done in any process and the file can be closed after.