On Thu, Jan 05, 2006 at 06:50:22PM -0800, David Lang wrote:
> On Thu, 5 Jan 2006, Mark Liberman wrote:
> 
> >Obviously, I will be testing this - but it might take a few days, as I 
> >haven't
> >figure out how to simulate the "period of inactivity" to get the data 
> >flushed
> >out of the cache ... so I have to run this each morning.
> 
> cat large_file >/dev/null
> 
> will probably do a pretty good job of this (especially if large_file is 
> noticably larger then the amount of ram you have)

The following C code is much faster...

/*
 * $Id: clearmem.c,v 1.1 2003/06/29 20:41:33 decibel Exp $
 *
 * Utility to clear out a chunk of memory and zero it. Useful for flushing disk 
buffers
 */

int main(int argc, char *argv[]) {
    if (!calloc(atoi(argv[1]), 1024*1024)) { printf("Error allocating 
memory.\n"); }
}

Compile it and then pass in the number of MB of memory to allocate on
the command line.
-- 
Jim C. Nasby, Sr. Engineering Consultant      [EMAIL PROTECTED]
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to