Unicode conversion exceptions and memory leaks
| From: | Andrei Zmievski | Date: | Thu, 13 Apr 2006 22:44:34 +0000 |
| Subject: | Unicode conversion exceptions and memory leaks | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-22739@lists.php.net to get a copy of this message | ||
If you run this code in PHP 6 right now, you will get a nice memory leak notice.
<?php
unicode_set_error_mode(FROM_UNICODE, U_CONV_ERROR_STOP | U_CONV_ERROR_EXCEPTION);
$u = "< \u3844 >";
try {
$s = (binary)$u;} catch (UnicodeConversionException $e) { } ?> /homes/andrei/dev/php-src/Zend/zend_unicode.c(461) : Freeing 0x013FC4E4 (1 bytes), script=e.php From what Dmitry tells me, it is impossible to fix this with the way our exceptions are implemented currently. I trust him on this, but at the same time I think we need to do something. The conversions will be happening in a lot of place and being able to catch an exception, if one results, is an important part of the workflow. I think Dmitry proposed that we could re-write exceptions implementation, but also said that it would be a lot of work. I think we should seriously consider it, though. Thoughts? -Andrei