Re: persistent memory management

From: Date: Sun, 03 Dec 2006 09:22:49 +0000
Subject: Re: persistent memory management
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-26768@lists.php.net to get a copy of this message
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

« previous php.internals (#26768) next »