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

List:       nyphp-talk
Subject:    Re: [nyphp-talk] PHP Scope in foreach construct.
From:       Daniel Convissor <danielc () analysisandsolutions ! com>
Date:       2009-01-28 18:24:37
Message-ID: 20090128182436.GB19850 () panix ! com
[Download RAW message or body]

Hi Anthony:

On Mon, Jan 26, 2009 at 09:27:43AM -0800, Anthony Wlodarski wrote:

> When working with foreach constructs do the functions and variables 
> defined get returned to the garbage collector on each iteration or does 
> the foreach have to finish execution before things can be returned to 
> the garbage collector?

The test I provided in another email in this thread makes it seem like 
garbage collection is happening on each iteration.


> The reason that I ask is because we are generating data for Google Maps 
> and they require one very large XML file which keeps blowing our memory 
> size definition inside the php.ini file.

Are you storing the XML output in memory while you're looping then 
writing it to file?  Or are you writing it directly to the file while 
you're looping?  I'd do the latter when memory optimization is an issue.


> What we might end up doing is creating the XML file in batches of lets 
> say 500 items or less and then append the files manually.

That shouldn't be necessary.  Even if you go with that approach, you can 
append all output to one file rather than creating multiple files and 
merging those.

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
_______________________________________________
New York PHP User Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/show_participation.php
[prev in list] [next in list] [prev in thread] [next in thread] 

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