Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66474 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79130 invoked from network); 5 Mar 2013 18:25:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Mar 2013 18:25:42 -0000 Authentication-Results: pb1.pair.com header.from=tom@punkave.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tom@punkave.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain punkave.com designates 209.85.160.53 as permitted sender) X-PHP-List-Original-Sender: tom@punkave.com X-Host-Fingerprint: 209.85.160.53 mail-pb0-f53.google.com Received: from [209.85.160.53] ([209.85.160.53:36650] helo=mail-pb0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/23-58003-6A836315 for ; Tue, 05 Mar 2013 13:25:42 -0500 Received: by mail-pb0-f53.google.com with SMTP id un1so4776252pbc.26 for ; Tue, 05 Mar 2013 10:25:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=iG+wP8fznXEU4PeGo4gR7BC05XT+haKXzt1nt7tC2Kc=; b=gCPic+LgE7j0HoodwvdTYQ931OnEaWgmzWx+yiktws3DmUOBmFpH4RMUl5TaxRlY6d Z3AOS+xi1GaG5tMErsKG8v2FFKH1L0Xmn6oShJVzrRmCpMZfNgUBXKEseefsti4STVM0 UVfqlgrPHJSy/StT66NhzlzB46c7CSjzgJXVmzltpi+OwfLzThUrYXMQ+rb614zFkADQ /XrRgZaNu/cMZ7GMEsZtXs9/OJf8oIe7/6Y4yHusSOheu1bnKASKkPCGebi4pM2mcjr+ yLreRy2nmknPGcDwhYZBopgUs3p7yodV05aaj8Nr9oDKUiql0y7HHt5r1UMjZzpGkn8V UIPQ== MIME-Version: 1.0 X-Received: by 10.68.197.168 with SMTP id iv8mr38861341pbc.114.1362507939166; Tue, 05 Mar 2013 10:25:39 -0800 (PST) Received: by 10.70.41.79 with HTTP; Tue, 5 Mar 2013 10:25:39 -0800 (PST) In-Reply-To: <0f1001ce19ce$8ce5a260$a6b0e720$@starin.biz> References: <0f1001ce19ce$8ce5a260$a6b0e720$@starin.biz> Date: Tue, 5 Mar 2013 13:25:39 -0500 Message-ID: To: nathan@starin.biz Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQk9DvZq+XlsvODfq7ShM42p5ytoRBRowLpFk7sII4rDJvhmLhfiZooPCuETks5qWPvjrKRC Subject: Re: [PHP-DEV] Memory warning hook From: tom@punkave.com (Tom Boutell) Can't you do this already? memory_limit can be fetched via ini_read, and together with memory_get_usage you should be able to check for this sort of thing. Admittedly having to parse memory_limit (which can be in various units) is not perfect. On Tue, Mar 5, 2013 at 1:23 PM, wrote: > As PHP applications are turning into large frameworks one of the issues > arriving is memory management. One of the issues is that many frameworks use > sophisticated caching techniques to make accessing the same data quickly, > this improves speed it is at the cost of memory. Often the developer knows > these areas that cache and often times already have functions in place to > clear out the cache, however in the case where PHP is approaching or exceeds > memory limits PHP runs the GC then dies if it cannot allocate enough memory. > If we implemented "memory warning" triggers or user function that will be > called before the GC is executed which allows the user to try and free up > some memory on their own. This hopefully would give more flexibility to > allowing these advanced caching techniques but at the same time allow the > cache to be cleared out in case memory is getting low. > > > > Thoughts? > > > > Thanks, > > Software Developer > > Nathan Bruer > > > -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com