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

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

Re: [Gnu-arch-users] ANNOUNCEMENT -- "timestamps" optimization


From: Jason McCarty
Subject: Re: [Gnu-arch-users] ANNOUNCEMENT -- "timestamps" optimization
Date: Sat, 13 Sep 2003 21:33:20 -0400
User-agent: Mutt/1.5.4i

Miles Bader wrote:
> [It's a bit hard to tell for sure, since I don't know a reliable and
> convenient method to flush the disk cache -- starting lots of big apps
> multiple times is a pain, and just touching lots of mallocated memory
> in a program doesn't seem to work reliably.]

I used a program that either allocated all the space it could, or
allocated a given amount of memory to simulate a low-memory condition.
It seems to work pretty well; even though `free' reports space still
used by the cache, none of it seems to be the files that tla wants. It's
a bit difficult to create just the right amount of free space though,
since it tends to get killed when tla causes a OOM condition ;-)

Jason


#include <stdlib.h>
#include <stdio.h>

int main (int argc, char** argv)
{
  size_t size;
  if ((argc > 1) && (size = atoi(argv[1]))) {
    /* allocate given amount of memory in megabytes */
    void* ptr;
    if (ptr = calloc(size << 20, 1)) {
      getchar(); /* exit when key is pressed */
      free(ptr);
      return 0;
    }
  } else /* allocate all memory */
    while (1)
      calloc(4096, 1);
  return 1;
}




reply via email to

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