It is very likely that this has something to do with DOM. It's a huge piece
of code though, making it hard to test where the problem really lies.

""Ron Korving"" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> I've noticed that in a script of mine, memory consumption can explode
quite
> drastically when Exceptions are thrown, opposed to very normal memory
> consumption when exceptions are not thrown.
>
> This is the idea:
>
> <?
> class Obj
> {
>   function process($i)
>   {
>     // do a lot of stuff, occupy a lot of memory within the scope of this
> function
>     throw new Exception("error");
>   }
> }
>
> $obj = new Obj();
> $errors = array();
>
> for ($i=0; $i < 60; $i++)
> {
>   try
>   {
>     $obj->process();
>   }
>   catch (Exception $e)
>   {
>     $errors[] = $e->getMessage();
>   }
> }
> ?>
>
> When exceptions are not thrown, memory consumption is normal. The method's
> local vars are freed and not much more memory is used in the 50th pass
> compared to the 1st. But when exceptions are thrown, memory consumption
> increases quite a bit every pass. In the end (within the 60 passes of my
> loop) over 8 MB's are used.
>
> Of course, I can unset a lot of data before throwing exceptions to free up
> memory and the problem will be solved. But it would be nicer if the
cleanup
> would happen as an exception is thrown.
>
> Can this be considered a bug or is this behavior known and accepted?
>
> Ron

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

Reply via email to