Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47945 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99426 invoked from network); 15 Apr 2010 06:03:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Apr 2010 06:03:33 -0000 Authentication-Results: pb1.pair.com header.from=jerome@loyet.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jerome@loyet.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain loyet.net from 72.14.220.155 cause and error) X-PHP-List-Original-Sender: jerome@loyet.net X-Host-Fingerprint: 72.14.220.155 fg-out-1718.google.com Received: from [72.14.220.155] ([72.14.220.155:9766] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/51-20494-23CA6CB4 for ; Thu, 15 Apr 2010 02:03:32 -0400 Received: by fg-out-1718.google.com with SMTP id 22so2319347fge.11 for ; Wed, 14 Apr 2010 23:03:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.239.135.83 with HTTP; Wed, 14 Apr 2010 23:03:27 -0700 (PDT) In-Reply-To: References: <4BC58D10.4050609@lerdorf.com> Date: Thu, 15 Apr 2010 08:03:27 +0200 Received: by 10.239.186.79 with SMTP id f15mr482903hbh.103.1271311407803; Wed, 14 Apr 2010 23:03:27 -0700 (PDT) Message-ID: To: =?UTF-8?B?5ruV6Lev6YGl?= Cc: Rasmus Lerdorf , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] One suggestion to PHP-FPM From: jerome@loyet.net (=?ISO-8859-1?B?Suly9G1lIExveWV0?=) 2010/4/15 =E6=BB=95=E8=B7=AF=E9=81=A5 : > We check error log after our server crashed, and we found that php heap > memory is out of limit, > so I think imagick use emalloc to allocate php heap memory, to check the > zend_memory_usage is > not a method for imagick, other circumstances which occupy huge memory ca= n > use this method to > ensure the system have enough free memory. OK, one thing I didn't understand is "why should you want check de zend memory usage when there is a memory_limit parameter in PHP.ini " ? does'nt it do the same at PHP layer when allocating ? > > thanks, > =C2=A0=C2=A0=C2=A0 looyao > > 2010/4/14 Rasmus Lerdorf >> >> On 04/14/2010 02:01 AM, J=C3=A9r=C3=B4me Loyet wrote: >> > The patch seems good (I didn't test it yet) but I'm curious about the >> > way you check the memory real size: >> > >> > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if(zend_memory_usage(1 TSRMLS_CC) > >> > fpm_global_config.term_on_memory_limit){ >> > >> > I don't know much about the zend_memory_usage() function. But does it >> > return the real memory size of the process ? >> >> Right, that will only give you the memory allocated by the memory >> manager, obviously. =C2=A0But, pecl/imagick does seem to use emalloc to >> allocate the imagick objects. =C2=A0However, if the underlying magickwan= d >> library mallocs a bunch of temporary space on its own, this will not get >> picked up. >> >> -Rasmus > >