Oliver Block wrote:
Hello,

I rewrote imap_mail_compose() and (almost) everything works fine, but I can't
get rid of some memory leaks.

In order to compose nested mutlipart messages I created a hash_table

[Mon Mar 19 23:44:36 2007]  Script:  '/root/compose_multipart.php'
/usr/local/src/php-5.2.1/Zend/zend_execute.c(1062) :  Freeing 0x40835DA4 (32
bytes), script=/root/compose_multipart.php
/usr/local/src/php-5.2.1/Zend/zend_alloc.c(1917) : Actual location (location
was relayed)
[Mon Mar 19 23:44:36 2007]  Script:  '/root/compose_multipart.php'
/usr/local/src/php-5.2.1/Zend/zend_execute.c(1006) :  Freeing 0x40835DF4 (35
bytes), script=/root/compose_multipart.php
/usr/local/src/php-5.2.1/Zend/zend_hash.c(388) : Actual location (location was
relayed)
Last leak repeated 1 time
[Mon Mar 19 23:44:36 2007]  Script:  '/root/compose_multipart.php'
/usr/local/src/php-5.2.1/ext/imap/php_imap.c(3340) :  Freeing 0x40836E4C (44
bytes), script=/root/compose_multipart.php
/usr/local/src/php-5.2.1/Zend/zend_API.c(819) : Actual location (location was
relayed)
Last leak repeated 1 time
=== Total 5 memory leaks detected ===

That's what I found out so far:
                        
When the function that is called in the script (/root/compose_multipart.php) is
accessed, the address  0x40835DA4 has the value 0x40835DF4 at the very
beginning. The address 0x40835DF4 has 0x00000000.

Can anybody help me to understand the output?

Well, the output gives you line of code where the block was allocated, e.g.:


> /usr/local/src/php-5.2.1/ext/imap/php_imap.c(3340) : Freeing 0x40836E4C (44
> bytes), script=/root/compose_multipart.php

Check your code to see what's in this line - that is probably the allocation which was not freed.

Usually forgetting to free hashtable generates a number of leak messages, since hashtable has main structure, buckets, etc.

--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to