Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51378 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29981 invoked from network); 31 Jan 2011 00:45:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2011 00:45:26 -0000 Authentication-Results: pb1.pair.com header.from=mail_ben_schmidt@yahoo.com.au; sender-id=unknown; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=mail_ben_schmidt@yahoo.com.au; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain yahoo.com.au from 98.139.52.217 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: mail_ben_schmidt@yahoo.com.au X-Host-Fingerprint: 98.139.52.217 nm20.bullet.mail.ac4.yahoo.com Received: from [98.139.52.217] ([98.139.52.217:21203] helo=nm20.bullet.mail.ac4.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B4/68-10828-326064D4 for ; Sun, 30 Jan 2011 19:45:24 -0500 Received: from [98.139.52.193] by nm20.bullet.mail.ac4.yahoo.com with NNFMP; 31 Jan 2011 00:45:21 -0000 Received: from [98.139.52.138] by tm6.bullet.mail.ac4.yahoo.com with NNFMP; 31 Jan 2011 00:45:21 -0000 Received: from [127.0.0.1] by omp1021.mail.ac4.yahoo.com with NNFMP; 31 Jan 2011 00:45:21 -0000 X-Yahoo-Newman-Id: 424919.30258.bm@omp1021.mail.ac4.yahoo.com Received: (qmail 73673 invoked from network); 31 Jan 2011 00:45:20 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.au; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=SzaKnL4n+o7RUd6LlXHFsd6D03iLNlTP7TWfCA46jaV08L++Tbf2fBjNjskH+UYCHSVgOEoidbcagCzQXT7TLbzh5BPs/JPyXsSCZC/CF2U+bwBwk8bUv3yHrYeDeOEditN0ep/WOH0i94BQd0gfUburWcatYrDehp+ZKncOPWE= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.au; s=s1024; t=1296434720; bh=ESGq04CQvmk+0mTVJAvTvk+TPPuiihBzq1TcU/IQbEw=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Y8pZyUPmHhKjVil65ao2SDLfRlRAu7j0MJQ4JNnXBupLKPkKRTH8Ksu/W61jy2WQut647IFrLpTcHc7Jzg9Xpz/lo7PHHO+c37ykvyYOeS3Ypwr7VaQaeKIKUIwh0rTgmGHp+e5q2zgpH4IimbK/GQh4yFfYXSVLVtOfYF74/x0= Received: from thought.local (mail_ben_schmidt@220.235.36.201 with plain) by smtp131.mail.mud.yahoo.com with SMTP; 30 Jan 2011 16:45:20 -0800 PST X-Yahoo-SMTP: enFMnPSswBAexaHyzgobwuUTrYOhZdJ0KRA2SjA- X-YMail-OSG: kFBQ.gIVM1nCMrXPnz2XAmuodbpqBl3k9pbG13YiQIp1Et1 pJJ0KCexFEq9AuhU5mXxWZYjJR7l7PZ4mMLrPaT2HDWcRNv8YLBLt0XcS1Oo 4RJsde6MPxJAWI3djxs5.cUSo_C9ll44qIzEz02VgI0GLa.uor3skyjdntkM 4_2jXVZpBqnXqKws7HULDCYfhC8bjd7xivK3yhlvM3PsX7vyOIMuRYMitx3N rD3O7Svzz0vr8cPyJpDqjjWBAUWojylCkLDF0gY.vI4miZM86vSxI0FmTN0Q zjplOo3yiU9uYkA-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4D46061C.5070305@yahoo.com.au> Date: Mon, 31 Jan 2011 11:45:16 +1100 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 ThunderBrowse/3.3.4 MIME-Version: 1.0 To: Adi Mutu CC: internals@lists.php.net, tony@daylessday.org References: <644047.16701.qm@web43509.mail.sp1.yahoo.com> In-Reply-To: <644047.16701.qm@web43509.mail.sp1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Zend mm From: mail_ben_schmidt@yahoo.com.au (Ben Schmidt) On 30/01/11 4:11 AM, Adi Mutu wrote: > I have looked at the sources, but i'm only at the begining of > analyzing the php sources.....i've understand how to write extensions > for example, but this memory manager seems more complicated to me..... Yes, it is. Memory management is a low-level and subtle area. It takes a lot of careful thought to design and even to understand the algorithms involved. It is hard to debug, because an error caused in one place may not show itself until completely different code is executing. It is also an area which doesn't change much. Almost all the other code in the PHP interpreter, and therefore PHP scripts themselves, rely on the memory manager code doing its job unintrusively and correctly, so once it is working well, it tends to be left that way, except for fixing small bugs as they are found, or a big and careful development effort to address some limitation (e.g. improving the garbage collection to collect cycles, which was something done fairly recently). The bottom line is that this is not an area that is all that easy for beginners to get their teeth into. But it's also an area that isn't necessary for beginners to understand in much detail, either. Unless you have a particular project in mind that involves the memory manager, you probably don't need to touch it. I don't want to discourage you, but just point out that perhaps this is something you might look at later, or even not at all, as you may find there are many worthwhile projects that take up all your time before you ever get to understanding the memory manager fully. > It would be useful if for example, could explain me the structures > that are used in the Zend memory manager, how they're chained > etc.....and if you can tell me in words what do zend_mm_aloc_int() and > zend_mm_free_int() basically do...Thank you for your time,Adrian I suspect these structures and functions are fairly easy to understand by someone familiar with the area of memory management, which is why you have been advised to consult the source code. So perhaps what you need to do is not learn about PHP's memory manager, but just learn about memory management in general. Then it should be fairly easy to understand what PHP's memory manager is doing from its code. I'm afraid I doubt the people here have the time to teach you this over email. :-) So here are some references which might be of use to you. - I believe the 'standard textbook' for learning about memory management is this one here: http://www.cs.kent.ac.uk/people/staff/rej/gcbook/gcbook.html - This page also mentions that a new edition is due out soon: http://c2.com/cgi/wiki?GarbageCollectionBook - You can also check out this site: http://www.memorymanagement.org/ - Relating this to, PHP: PHP is a garbage collected language which I believe uses reference counting and a clever collector to detect and free cycles. I haven't looked in detail into the implementation, but I know some documentation is available on the subject here: http://www.php.net/manual/en/features.gc.php Hope this helps! Ben.