Re: Re: drastic memory consumption with a sequenceofexceptions
| From: | Markus Fischer | Date: | Wed, 10 Aug 2005 14:31:22 +0000 |
| Subject: | Re: Re: drastic memory consumption with a sequenceofexceptions | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-17790@lists.php.net to get a copy of this message | ||
This is also apply if you use the reference operator?
foreach ($data as &$lines) { ..
?
- Markus
Wez Furlong wrote:
foreach() 'copies' $data, and it's the copy that isn't going away. --Wez. On 8/10/05, Ron Korving <r.korving@xit.nl> wrote:"Derick Rethans" <derick@php.net> schreef in bericht news:Pine.LNX.4.62.0508101456350.3884@localhost...On Wed, 10 Aug 2005, Ron Korving wrote:inMy situation is parsing a number of XML-reports. If parsing goes wrongfails),any way (XML parsing fails, XML validation fails, database insertiontheseI want to throw an exception. There's a script that batch-processesIfiles. I want to collect exceptions and give that feedback to the user.Actually, no. Even this shows the problem: foreach ($data as $line) {wouldn't consider this bad practice myself (but of course, I'm not very objective in this situation).You can still clean up your memory before throwing the exception...unset($data); throw new Exception("error");}humbleEven if I'm wrong about that, I'm not the only PHP-user and it's myI never thought it would be easy. And I'm not saying it must be fixed. But I do think, more on the philosophical level as a programmer, that the engine "should" be able to deal with that situation. Ron -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.phpopinion that the engine should be solid enough to deal with this.It's not easy at all, it would basically mean a full rewrite of the engine's refcounting/garbage collection system, and also redoing all extensions to use this mechanism. I think that's a bit too much to ask just so that you don't get a leak if you're doing something 'weird'.