Hi Michael,

It is not a bug. You understood proper. Internal classes are stored in
regular heap and they don't use e[memory] function family.
This is done, because memory allocated by emalloc is freed after each
request, but internal classes should still alive in global class table.

Thanks. Dmitry.

> -----Original Message-----
> From: Michael Wallner [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, July 21, 2005 11:25 PM
> To: internals@lists.php.net
> Subject: [PHP-DEV] Re: static members of internal classes
> 
> 
> Hi I wrote:
> 
> > I wrote:
> >
> >
> >>I have some issues with static members of internal classes. 
> AFAICS no 
> >>extension uses them so far (did I miss something?).
> >
> > I cannot declare static properties as strings because that causes 
> > memory errors in zval_dtor() (SET_STATIC_PROP_EX code is 
> actually the 
> > same as in ReflectionClass::setStaticPropertyValue), further the 
> > strings duplicated by zval_copy_ctor() leak once.
> 
> Finally it seems to boil down to property initialization.
> ZE uses malloc/free for ZEND_INTERNAL_CLASS' properties
> while the properties contents will most likely be replaced
> with emalloc()'d addresses.
> 
> I think the line
> 
>       zend_hash_init(zo->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
> 
> in the class ctor is pretty common, but for static properties it is
> 
>       zend_hash_init_ex(ce->static_members, 0, NULL, 
> ZVAL_INTERNAL_PTR_DTOR, persistent_hashes, 0);
> 
> in zend_initialize_class_data().
> 
> I'm quite puzzled now, because zend_declare_property() also 
> uses malloc instead of emalloc() for non-static properties.
> 
> Do I need to omit e[memfunc]() for static properties?
> Is it even a bug?
> Do I need to go to bed?
> 
> Thanks,
> --
> Michael - < mike(@)php.net >
> 

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

Reply via email to