FAQ
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

Search Discussions

  • Marcus Börger at Apr 13, 2003 at 10:33 am

    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 at Apr 13, 2003 at 11:14 am

    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 at Apr 13, 2003 at 12:04 pm

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedApr 13, '03 at 7:12a
activeApr 13, '03 at 12:04p
posts4
users2
websitephp.net

2 users in discussion

Marcus Börger: 2 posts L0t3k: 2 posts

People

Translate

site design / logo © 2022 Grokbase