gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Re: [PATCH] arch speedups on big trees


From: David Allouche
Subject: Re: [Gnu-arch-users] Re: [PATCH] arch speedups on big trees
Date: Mon, 12 Jan 2004 15:25:30 +0100
User-agent: Mutt/1.5.4i

On Fri, Jan 09, 2004 at 10:11:36AM -0500, Aaron Bentley wrote:
> Anyone know of a utility that will clean out your cache?  Or would "grep
> -r foo /" be the way to go?

That is what I use when I make benchmarks:

#include <stdlib.h>

static const int n=10000000;

int main (int argc, char** argv) {
  int i, *p;
  while (1) {
    p=malloc (sizeof(n)*n);
    for (i=0; i<n; i++) {
      *p=i;
      p++;
    }
  }
  return 0;
}

What this does is just mallocing and touching memory until the kernel
out-of-memory killer nukes the program.

That flushes all kernel caches and buffers as well as possible. Only
problem is _if_ you have an oversized swap, it will be slow. Anyway
having an oversized swap is a bad thing, because real-life programs
sometimes go berserk this way, and with too big a swap they can make
your system unusable for ages before the OOM killer comes.

-- 
                                                            -- ddaa




reply via email to

[Prev in Thread] Current Thread [Next in Thread]