[PHP-DEV] Deleting array? From: Uwe Steinmann (steinm <email protected>)
Date: 09/29/99

Hi,

I have written some code in the hyperwave module which uses
an associated array as a temporary internal data structure.
The array is created at the beginning of a function:

    MAKE_STD_ZVAL(spec_arr);
    array_init(spec_arr);
    add_assoc_long(spec_arr, "Title", HW_ATTR_LANG);
    add_assoc_long(spec_arr, "Description", HW_ATTR_LANG);
    add_assoc_long(spec_arr, "Keyword", HW_ATTR_LANG);
    add_assoc_long(spec_arr, "Group", HW_ATTR_NONE);

and should be removed at the end of that function:

    zend_hash_destroy(spec_arr->value.ht);
    efree(spec_arr);

I wonder if this is the right way, because it still leaks
memory:

zend_hash.c(190) : Freeing 0x0833E750 (4 bytes), script=/usr/local/apache/htdocs/hw/leak.php3
Last leak repeated 3 times
zend_hash.c(180) : Freeing 0x0833E6F0 (41 bytes), script=/usr/local/apache/htdocs/hw/leak.php3
Last leak repeated 3 times
zend_API.c(231) : Freeing 0x0833E6A8 (20 bytes), script=/usr/local/apache/htdocs/hw/leak.php3
Last leak repeated 3 times
zend_hash.c(100) : Freeing 0x0833DB18 (20 bytes), script=/usr/local/apache/htdocs/hw/leak.php3
zend_API.c(192) : Freeing 0x081E1C08 (44 bytes), script=/usr/local/apache/htdocs/hw/leak.php3

BTW, this is in ext/hyperwave/hw.c, function make2_return_array_from_objrec()

  Uwe

-- 
  Uwe.Steinmann <email protected>
  Tel: +2331 987 4528    Fax: +2331 987 375

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>