Re: [squid-users] xmalloc and out of memory errors in messages log

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 10 Oct 2003 13:13:55 +0200 (CEST)

On Fri, 10 Oct 2003, Tay Teck Wee wrote:

> > How large is the process shortly before it dies?
>
> 900M

And how large processes does your sustem support?

Try this small C test program:

// begin test.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
  int size = 0;
  char *ptr;

  while ((ptr = malloc(1024)) != NULL) {
     size += 1;
     *ptr = 1;
     if (!(size & 0x3FF))
       printf("allocated memory: %d MB\n", size / 1024);
  }
  printf("Max allocated memory: %d KB (%d MB)\n", size, size / 1024);
}
// end test.c

cc test.c
./a.out

Regards
Henrik
Received on Fri Oct 10 2003 - 05:14:00 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:20:27 MST