Hello Alan, it seems you are registering constants on an internal class. If so you must use the correct api since your data must be allocated by malloc instead of emalloc. In your codes i can only see regular stuff that uses emalloc so it must go wrong.
marcus Thursday, April 7, 2005, 5:10:53 PM, you wrote: > I'm using the code below to register object constants, however I'm > getting a memory leak on the line shown.. , any ideas how to avoid this? > /var/svn_live/dbdo/dbdo.c(401) : Freeing 0x0860FC34 (16 bytes), > script=examples/info.php > #define hash_add_assoc_long(__arg, __key, __val) > hash_add_assoc_long_ex(__arg, __key, strlen(__key)+1, __val) > int hash_add_assoc_long_ex(HashTable *arg, char *key, uint key_len, long > n) > { > zval *tmp; > MAKE_STD_ZVAL(tmp); // <-- 401 leaking here. > ZVAL_LONG(tmp, n); > return zend_symtable_update(arg, key, key_len, (void *) &tmp, > sizeof(zval *), NULL); > } > PHP_RINIT_FUNCTION(dbdo) > { > ..... > zend_hash_init(&dbdo_class_entry_ce->constants_table, 0, NULL, NULL, > 1); > /* fetch all returns */ > hash_add_assoc_long(&(dbdo_class_entry_ce->constants_table), > "OBJECTS", > 0); > hash_add_assoc_long(&(dbdo_class_entry_ce->constants_table), > "KEY_VALUE", 1); > hash_add_assoc_long(&(dbdo_class_entry_ce->constants_table), "VALUE", > 2); > hash_add_assoc_long(&(dbdo_class_entry_ce->constants_table), "SINGLE", > 3); > /* update/delete build or use fetchedobject. */ > hash_add_assoc_long(&(dbdo_class_entry_ce->constants_table), "BUILD", > 1); > /* error constants */ > hash_add_assoc_long(&(dbdo_class_entry_ce->constants_table), "E_ALL", > 3); > hash_add_assoc_long(&(dbdo_class_entry_ce->constants_table), "E_FULL", > 63); > .... -- Best regards, Marcus mailto:[EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php