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

Bug#485413: memory leak



Hi Valentin,

On Wed, 10 Feb 2010, Valentin Vidic wrote:
www-data  2220  7.3  5.8 223840 30064 ?        S    13:10   0:01  \_ /usr/sbin/a

Apache child consumes 30MB of memory after accessing a PHP5 page (Horde/IMP).

Does the apache child grow without bounds when it serves more requests or does it stay constant? In the latter case, it is not really a memory leak but normal memory usage. It is normal behaviour for apache to not return memory to the operating system. Within some limits, you can influence that behaviour with the MaxMemFree directive.

It looks like this has to do with memory allocations from PHP because if I
add this line to /etc/apache2/envvars

 export ZEND_MM_MEM_TYPE=mmap_anon

memory usage goes down to around 10MB per child:

This is also expected: Using mmap means that unused memory is returned to the kernel immediately. But it is less efficient because when more memory is allocated again, the kernel has to overwrite the memory with zeros each time.

The normal malloc also uses mmap for large block allocations. But the meaning of 'large' may be different on 32 and 64bit. This would explain the different behaviour you see on i386 and amd64.

Cheers,
Stefan



Reply to: