Stas Malyshev | 1 Oct 2010 03:06
Favicon
Gravatar

Re: [PHP-DEV] Understanding the benefits of handling Bucket data in PHP's HashTables

Hi!

The bucket can store 2 types of data - either any random piece of data 
(ARPD) or a pointer. When bucket with ARPD is created/deleted, the 
memory storing ARPD is allocated/freed. When bucket holding a pointer is 
created/freed, nothing special happens since the pointer is stored 
inside the bucket.
zend_hash_find returns the pointer to the data stored, not the copy of 
it (since you might want to modify it), that's the reason why it's 
void** - it's pointer to the data, which is by itself either pointer 
passed to hash or pointer to allocated piece for ARPD.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Gmane