On Wed, 2008-09-03 at 18:17 +0200, Lupus Michaelis wrote: > Robert Cummings a écrit : > > > Please explain how it can take up more than twice. > > It is obvious for a C developper. > > == 8< == Zend/zend.h > typedef struct _zval_struct zval; > > typedef union _zvalue_value { > long lval; /* long value */ > double dval; /* double value */ > struct { > char *val; > int len; > } str; > HashTable *ht; /* hash table value */ > zend_object_value obj; > } zvalue_value; > > typedef struct _zend_object { > zend_class_entry *ce; > HashTable *properties; > HashTable *guards; /* protects from __get/__set ... recursion */ > } zend_object; > > struct _zval_struct { > /* Variable information */ > zvalue_value value; /* value */ > zend_uint refcount__gc; > zend_uchar type; /* active type */ > zend_uchar is_ref__gc; > }; > > == 8< == > > When you write > $a = 1 ; > > The $a variable don't contain only the integer, it contains a lot of > more stuff. This stuff is needed by the fact that a variable can contain > every types available in PHP. > > So, I let you calculate the memory needed to store the variable, but > you can easily understand that they'll not be twice the previous memory > footprint, but a little more. I do develop in C so I now need to take a stick to you. It's still double space. Use a simple example for yourself. Let's say a struct like following: struct _foo { int i; int j; int k[5]; } foo; In 32 bit system we have: 32 bits for i + 32 bits for j + (32 bits for each k) * 5 + 32 bits for the pointer to foo = 32 * 8 In 64 bit system we have: 64 bits for i + 64 bits for j + (64 bits for each k) * 5 + 64 bits for the pointer to foo = 64 * 8 = (32 * 2) * 8 = (32 * 8) * 2 Exactly double. Please explain where I went wrong. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php