[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    [PHP-DEV] Deleting array?
From:       Uwe Steinmann <steinm () gehtnix ! fernuni-hagen ! de>
Date:       1999-09-29 8:06:17
[Download RAW message or body]

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@fernuni-hagen.de
  Tel: +2331 987 4528    Fax: +2331 987 375

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic