CodeIgniter Forums
Possible to load too many views? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Possible to load too many views? (/showthread.php?tid=14399)



Possible to load too many views? - El Forum - 01-01-2009

[eluser]dcheslow[/eluser]
Hi there,

I am writing an application that generates text files. I am using views to format the various components that go into the text file. It all works fine until I generate a couple thousand components... which means that I load a couple thousand views. The weird things is that the application just quits... no error, no exception... it just exits.

So my question is... is it possible to load too many views? If so, is it possible to release whatever resources are being consumed?

Thanks in advance,

=dave=


Possible to load too many views? - El Forum - 01-01-2009

[eluser]xwero[/eluser]
if you load the views as strings to output in a template it's possible at some point all the memory gets consumed.

You could write a wrapper for the load->view method and instead of passing the views as strings, pass the file locations and load them in the template.


Possible to load too many views? - El Forum - 01-01-2009

[eluser]dcheslow[/eluser]
I checked memory usage... that's not the problem. I coded so that each view is shipped out to the file ASAP. Also, PHP generates an error when it runs out of memory... in my case the application just exits. To double/triple check, I increased PHP's memory...no change.

The app exits after the 650th view is loaded.

=dave=


Possible to load too many views? - El Forum - 01-01-2009

[eluser]xwero[/eluser]
What is the script time out limit?


Possible to load too many views? - El Forum - 01-01-2009

[eluser]majidmx[/eluser]
check your webserver and also PHP logs, there should definitely be an entry for this.


Possible to load too many views? - El Forum - 01-02-2009

[eluser]m4rw3r[/eluser]
Also, there is a stack limit in PHP (think it is around 100), which limits the call depth.
Because every call to Loader::view() calls the next nested view(), then it is stacked.

So I'll guess that the maximum nesting depth is about 80 views (less if you have many function/method calls before you call the view).


Possible to load too many views? - El Forum - 01-02-2009

[eluser]dcheslow[/eluser]
Fixed!

Lesson: never overlook the possibility that there are TWO errors.

I was, in fact, running out of memory.

While solving another bug I had overwritten php.ini with a version that had 'Display-errors = Off'... ergo, no visible feedback on the error. DOH!

Thanks to all who responded! ... and Happy New Year!

=dave=