Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48076 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71579 invoked from network); 26 Apr 2010 06:58:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2010 06:58:26 -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 209.85.218.216 cause and error) X-PHP-List-Original-Sender: jerome@loyet.net X-Host-Fingerprint: 209.85.218.216 mail-bw0-f216.google.com Received: from [209.85.218.216] ([209.85.218.216:47903] helo=mail-bw0-f216.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/B4-45124-09935DB4 for ; Mon, 26 Apr 2010 02:58:26 -0400 Received: by bwz8 with SMTP id 8so11511118bwz.23 for ; Sun, 25 Apr 2010 23:58:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.141.69 with SMTP id l5mr2256952bku.64.1272265101608; Sun, 25 Apr 2010 23:58:21 -0700 (PDT) Received: by 10.204.134.152 with HTTP; Sun, 25 Apr 2010 23:58:21 -0700 (PDT) In-Reply-To: References: <4BC58D10.4050609@lerdorf.com> Date: Mon, 26 Apr 2010 08:58:21 +0200 Message-ID: To: looyao teng Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] One suggestion to PHP-FPM From: jerome@loyet.net (=?ISO-8859-1?B?Suly9G1lIExveWV0?=) Le 26 avril 2010 04:02, looyao teng a =E9crit : > in linux, read the /proc/self(pid)/status,=A0 and the VmRSS(real memory u= sage) > or VmSize(virtual memory usage)=A0 is the the memory usage of=A0 the curr= ent > process. in fact I was looking of a cleaner way to do it. > > 2010/4/24 J=E9r=F4me Loyet >> >> 2010/4/14 Rasmus Lerdorf >> > >> > On 04/14/2010 02:01 AM, J=E9r=F4me Loyet wrote: >> > > The patch seems good (I didn't test it yet) but I'm curious about th= e >> > > way you check the memory real size: >> > > >> > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if(zend_me= mory_usage(1 TSRMLS_CC) > >> > > fpm_global_config.term_on_memory_limit){ >> > > >> > > I don't know much about the zend_memory_usage() function. But does i= t >> > > return the real memory size of the process ? >> > >> > Right, that will only give you the memory allocated by the memory >> > manager, obviously. =A0But, pecl/imagick does seem to use emalloc to >> > allocate the imagick objects. =A0However, if the underlying magickwand >> > library mallocs a bunch of temporary space on its own, this will not g= et >> > picked up. >> >> does someone know a way to get the memory usage of the current process ? >> getrusage is not accurate in linux. >> >> Thx >> ++ jerome > >