Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25002 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78508 invoked by uid 1010); 27 Jul 2006 12:52:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 78493 invoked from network); 27 Jul 2006 12:52:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jul 2006 12:52:48 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; domainkeys=good DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 64.233.166.181 py-out-1112.google.com Linux 2.4/2.6 Received: from ([64.233.166.181:23263] helo=py-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 9F/BE-23194-F17B8C44 for ; Thu, 27 Jul 2006 08:52:48 -0400 Received: by py-out-1112.google.com with SMTP id n25so170769pyg for ; Thu, 27 Jul 2006 05:52:44 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=googlemail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=GpfpB18cfr2inbIQXQbsRLx42ypGrHtLSrbSVk+11R5mNVg4CP1OddbeomkZfXXB97y54iuw89i1P17fJbrSA5E1gIVeDaKWm2mwQK6VFDAQq2ABFxTZC5rbV/UPI9fXUOUxRcHdU31w2kaPpzdpzWtTvCv3JzZo8NMwjZwzsZ4= Received: by 10.35.90.20 with SMTP id s20mr13101030pyl; Thu, 27 Jul 2006 05:52:44 -0700 (PDT) Received: by 10.35.93.18 with HTTP; Thu, 27 Jul 2006 05:52:44 -0700 (PDT) Message-ID: <10845a340607270552t38af4becq5903d24d8a54aa93@mail.gmail.com> Date: Thu, 27 Jul 2006 13:52:44 +0100 Reply-To: RQuadling@GoogleMail.com To: "Ilia Alshanetsky" Cc: "Matt W" , internals@lists.php.net, "Dmitry Stogov" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <00d601c6af9d$c18f2d30$0201a8c0@pc1> <003701c6afb1$81b87720$6e02a8c0@thinkpad> <44C6205F.4090808@php.net> <00ed01c6b163$c3d40ad0$0201a8c0@pc1> Subject: Re: [PHP-DEV] memory_get_usage with new Memory Manager From: rquadling@googlemail.com ("Richard Quadling") I'm NOT a expert in this field. My POV may be quite dumb, but it may point to a solution. If memory is allocated, I would assume that somewhere there is a mechanism to access it otherwise this is a memory leak. So, rather than counting the memory in real time, why not have the memory_get_usage() (not sure about peak usage) simply iterate the used memory and calculate how much there is. This would put the overhead in the function call and not throughout the rest of the code. On 27/07/06, Ilia Alshanetsky wrote: > > On 27-Jul-06, at 6:02 AM, Matt W wrote: > > > > Something else I'd like to see changed... Does anyone think > > memory_get_[peak_]usage() should *always* be available, regardless of > > whether memory_limit is actually enabled? Using the Windows > > binaries at > > least, I was devastated :-D that they were unavailable for > > experimenting, > > etc. > > Counting memory all the time adds a fair amount of overhead to script > execution especially given how frequently PHP needs to allocate > memory. Therefore usage memory utilization functions are only > available when PHP is compiled with memory in which case it keeps > track of its mem usage. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"