zend_class_entry memory leak ?

php.internals

l0t3k

23 years ago
i have the following code to register class constants : void register_class_long_constant_ex(zend_class_entry *ce, char *key, uint key_len, long lval) { HashTable *ht = &(ce)->constants_table; zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_LONG(tmp, lval); zend_hash_update(ht, key, key_len, (void *) &tmp, sizeof(zval *), NULL); } on shutdown, i get a report of a leak at MAKE_STD_ZVAL, once for each constant defined. am i doing something wrong, or is the class constant table not properly destructed ? l0t3k

(Marcus Börger)

23 years ago
At 09:13 13.04.2003, l0t3k wrote:
>i have the following code to register class constants : > >[...] > >on shutdown, i get a report of a leak at MAKE_STD_ZVAL, once for each >constant defined. am i doing something wrong, or is the class constant table >not properly destructed ?
You should use internal classes and do everything that needs memory with malloc/realoc/free instead of the e functions. The problem is the shutdown sequence. marcus

l0t3k

23 years ago
> You should use internal classes and do everything that needs memory > with malloc/realoc/free instead of the e functions. The problem is the
shutdown
> sequence.
Marcus, thanks for responding. im confused about what you mean by internal classes though. do you have a basic example ? l0t3k

(Marcus Börger)

23 years ago
At 13:15 13.04.2003, l0t3k wrote:
> > You should use internal classes and do everything that needs memory > > with malloc/realoc/free instead of the e functions. The problem is the >shutdown > > sequence. >Marcus, > thanks for responding. im confused about what you mean by internal classes >though. do you have a basic example ?
If you use any of the follwoing functions (as you should do): ZEND_API zend_class_entry *zend_register_internal_class(zend_class_entry *class_entry TSRMLS_DC); ZEND_API zend_class_entry *zend_register_internal_class_ex(zend_class_entry *class_entry, zend_class_entry *parent_ce, char *parent_name TSRMLS_DC); ZEND_API zend_class_entry *zend_register_internal_ns_class(zend_class_entry *class_entry, zend_class_entry *parent_ce, zend_namespace *ns, char *ns_name TSRMLS_DC); ZEND_API zend_namespace *zend_register_internal_namespace(zend_namespace *ns TSRMLS_DC); then you can't use any of emallo/erealloc/efree thats all you must know. marcus