Re: Memory allocation under Aix 4.2

From: Henrik Nordstrom <>
Date: Wed, 15 Jul 1998 22:50:21 +0200

Andy Lee wrote:
> I have been getting the unable to allocate x bytes errors under Squid
> 1.1.22 compiled on Aix4.2 using gcc 2.8.1 and running on 3/90 with
> 256MB ram with limits set to 0 for each user.

Have you looked in the FAQ?
What are your kernels limit on process size? Many OSes has a hard limit
which sometimes is not reported by ulimit.
How large is your cache?
How much swap space is available?
What is your cache_mem setting?

> Looking through the code it relies on calling xmalloc to allocate the
> memory required. Following through the normal headers (malloc.h)
> shows xmalloc takes three args from the man :

Squid provides it's own xmalloc which is like malloc but with error
checking. If you think that Squid gets confused by the other xmalloc in
your environment, then rename the Squid version.

cd squid-1.1.22
perl -pi -e 's/xmalloc/squid_xmalloc/g' */*.[ch]
make clean
make install

You said that your Squid slowly grows in size and then dies at 128MB.
During the first time of operation Squid does grow in size as various
structures and buffers are allocated, but the growth should stabilize
after some period of use. The fact that it dies at 128MB which is a very
even number on computers makes me suspect that there is some kind of
external limit on process size.

Try running a program that tries to allocate a lot of memory. If this
stops at 128MB as well then you know where the problem is.

Henrik Nordström
Sparetime Squid Hacker
------ cut here
#include <stdlib.h>
  long kb=64;
  char *ptr,*tmp=malloc(65536);
  while((ptr=malloc(65536))!=NULL) {
  printf("Could allocate up to %d MB\n",size/1024);
------ end
Received on Wed Jul 15 1998 - 15:15:21 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:41:07 MST