Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26768 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64132 invoked by uid 1010); 3 Dec 2006 09:25:42 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 64117 invoked from network); 3 Dec 2006 09:25:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Dec 2006 09:25:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@hristov.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@hristov.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hristov.com from 85.92.73.163 cause and error) X-PHP-List-Original-Sender: php@hristov.com X-Host-Fingerprint: 85.92.73.163 iko.gotobg.net Linux 2.6 Received: from [85.92.73.163] ([85.92.73.163:37388] helo=iko.gotobg.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DE/62-27055-0D792754 for ; Sun, 03 Dec 2006 04:25:07 -0500 Received: from irc-new1.mysql.com ([213.115.162.54] helo=[127.0.0.1]) by iko.gotobg.net with esmtpa (Exim 4.52) id 1GqnaG-0001xw-0d; Sun, 03 Dec 2006 11:24:28 +0200 Message-ID: <45729769.1080205@hristov.com> Date: Sun, 03 Dec 2006 10:22:49 +0100 User-Agent: Thunderbird 1.5.0.7 (X11/20060911) MIME-Version: 1.0 To: Alexey Zakhlestin CC: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iko.gotobg.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - hristov.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] persistent memory management From: php@hristov.com (Andrey Hristov) Hi, Alexey Zakhlestin wrote: > Hi. > > I am trying to make my first php extension :) > I am sorry, if the question would be too newbiesh, but I just couldn't > find a more correct place to ask > > here is the code: > http://loccache.googlecode.com/svn/trunk/loccache.c > > I am trying to do the following: > at the minit-phase I am allocating a persistent HashTable > extension has 4 funcitons: > * loc_set($namespace, $varname, $value); // stores $value > * loc_get($namespace, $varname) // returns $value from storage > * loc_isset($namespace, $varname) // returns bool > * loc_unset($namespace, $varname) // removes varname from storage > during loc_set, I chech if there is "$namespace" item in my persistent > hashtable, and if there isn't, I create it as a child hashtable > $varname is a key in that second HashTable and $value is the value > > something like: > $big_persistent_hash = array( > $namespace => array( > $varname => $value > ) > ); > > extension build and even tends to work... kinda.. > > unfortunately, persistent values are not too persistent in my case, and > i keep getting memory errors. > I would be grateful for any help. the source code is not too big :) Tried running the web server under memory checker like valgrind? Maybe instead of peamlloc() just do malloc() Andrey