Jump to content

Fatal error: Allowed memory size exhausted


Recommended Posts

Hi guys,

i'm having this error on some pages of my new project:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1412192 bytes) in /Applications/MAMP/htdocs/saf/dev/wire/core/TemplateFile.php on line 171
Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1412192 bytes) (line 171 of /Applications/MAMP/htdocs/saf/dev/wire/core/TemplateFile.php) 
This error message was shown because site is in debug mode ($config->debug = true; in /site/config.php). Error has been logged.
These pages are really content heavy. I think that the problem is related to a repeater inside that template.
This repeater has a page field inside and two text fields.
When there are 50 - 60 repeaters in a page i get that error, and sometimes i'm not even able to open that page from admin anymore.
Can you suggest how can I manage this problem?
Thanks a lot
Link to comment
Share on other sites

@teppo I'm using PW 2.5.3

@marijn yeah, i'm seeing that, but i thought that could be the easiest way to manage that pages for my client

@kongondo i've tried with PageTable, but the problem is that, as i can see, i can not choose existing page, just create new one, so for this reason PageTable is useless in this case

(Thanks guys)

Link to comment
Share on other sites

@kongondo yes, that's true, but i still think that probably repeaters are not the best thing in this case, so i'm trying to figure a different and lighter solution

I'll try to explain better my need.

Let's say i have two main templates: teachers and courses.

For every course i need to select a lot of teachers (as i've said before 50 or 60 or even more) but i can not use a simple page field because, for every course, i need to add some extra info for a techer.

So let's say i have the Math and French course pages. I've also 10 teachers page.

In the Math course i need to choose Mr. Brown (an hypothetical teacher) and add his specific email address for the math course, that is brown@mathcourse.com

In the French course i need to choose the same teacher, Mr. Brown, but with a different email address, brown@frenchcourse.com

That's why i thought to use a repeater, with a page field to choose the teacher page and a text field (or email field) for the email address.

Now i need to think something different, i guess.

Link to comment
Share on other sites

You can't select an "existing" page with a repeater either. You always create a new repeater element.

Your teacher example is possible with PageTable. Create a page template with a selectTeacher Page field and the textfield for the description. When someone wants to add a teacher to a course, he creates a new "page", select the teacher and enters additional information. Or did I miss anything?

Maybe your example is a little bit of, but having about 80 teachers for a course... Maybe better to add courses to a teacher (the other way)?

  • Like 1
Link to comment
Share on other sites

Hi verdeandrea, and thanks for a chance to think it over.

Why not have a template for Teachers where their names and emails would go, and another template with page fields which would display teachers' names and emails on your Course page?

I did a mock-up quickie. If you are curious as to how it might look, I've attached a couple of screenshots.




Link to comment
Share on other sites

Guys, sorry for the delay.

@kongodo your post about categories is really helpful, in fact i'm using the same structure you suggest.

@valery thanks for your answer and for taking the time to do that mockup. I've thought about use a repeater field in the teacher template, having a page field for courses and a email field, so that i can set a different mail for different courses directly from the teacher page (like you show in your third mockup), but i was afraid that this solution wasn't too comfortable for my client. Now I'm thinking again about this. It sure can resolve that memory size problem. I'll try and I'll let you know. I think i don't get your first and second mockup. Why should I choose emails in the course template if i've already chosen them directly in the teacher page for every course?

@philip i'll test your solution too (thanks!) using pageTable and see which one seem to be more suitable. I don't think I can let add courses to teacher template because it could be a little bit muddled for my client.

So this could be one try: 

- the course template has just a page field to choose the teachers pages.

- the teacher template has a repeater field where i can choose a course page and set an email for that course.

Whit this solution i'll have a page field with 60 pages selected and not a repeater field with 60 items. 

This should be lighter, shouldn't it?

And what if go with the Philip solution? In that case i would have a pageTable field with 60 pages selected. Is this "heavier" than a simple pageField with 60 pages selected?

Thanks, as always.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...