Welcome Guest, Not a member yet? Register   Sign In
Possible to load too many views?
#1

[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=
#2

[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.
#3

[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=
#4

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

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

[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).
#7

[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=




Theme © iAndrew 2016 - Forum software by © MyBB