Allowed memory size exhausted

Allowed memory size exhausted

by Daniel Mikšík -
Number of replies: 14
Picture of Core developers Picture of Translators
I have moved to a new webhosting company with one of my installations of Moodle (last CVS nigthly) and after installation and creation of the first course, I get the following error message in the Recent Activity box after entering the course. Could you please help me to decipher what the server is trying to tell me? TIA.

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in /var/www/mydomain/kursy/lang/en/workshop.php on line 88

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 136 bytes) in Unknown on line 0
Average of ratings: -
In reply to Daniel Mikšík

Re: Allowed memory size exhausted

by Williams Castillo -
Hi Daniel...

Just modify your php.ini. Your memory_limit variable should be 8M.. Change it for 16M. Perhaps you will have to ask your hosting provider to do this for you.

memory_limit = 16M

Regards,
Will
In reply to Williams Castillo

Re: Allowed memory size exhausted

by Lars Jensen -

Thanks! This worked for me too. I'm just not sure this is the right way to resolve the error...???

Lars.

In reply to Lars Jensen

Re: Allowed memory size exhausted

by Daniel Mikšík -
Picture of Core developers Picture of Translators
I'm not able to change the memory_limit (I would have to ask my webhoster and I don't know if they will be willing to change it for me). Please, Martin, what memory limit does the moodle.org server have? Because here everything is going just fine. Thank you.
In reply to Daniel Mikšík

Re: Allowed memory size exhausted

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It does seem odd, though, to use up 8M of memory on a brand-new empty course.  Might be a bug.  What happens after you create an activity in the course, or add a student?  Does the message still come up in Recent Activity?
In reply to Martin Dougiamas

Re: Allowed memory size exhausted

by Daniel Mikšík -
Picture of Core developers Picture of Translators
Well, I can't do anything in the course after I get that message - I get stuck, have to close the browser, log in, go to the course and get caught again. I can do everything else in the adminnistration of the site but not to go to the course.
I have created another new course but got the error again after trying to view it.
In reply to Daniel Mikšík

Re: Allowed memory size exhausted

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Try changing to English ...
In reply to Martin Dougiamas

Re: Allowed memory size exhausted

by Daniel Mikšík -
Picture of Core developers Picture of Translators
Yes, that helps, no fatal error warning now. What shall I do if I want to use the Czech translation?
In reply to Daniel Mikšík

Re: Allowed memory size exhausted

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Firstly, make sure you have the very latest version of that language pack from the language page.

If that doesn't help, then please help mudrd8mz@nwit.pedf.cuni.cz to find and fix the bug in it. wink
In reply to Martin Dougiamas

Re: Allowed memory size exhausted

by Daniel Mikšík -
Picture of Core developers Picture of Translators
Yes, I'm using the very latest language packs available in CVS. The trouble is that the error is appearing also when using for example German, which we also want to have at the site. Does it necessarily have to be related to the language packs themselves, or perhaps rather to Moodle handling the language packs? Just a thought.
Also, the error occurs only when other language than English is selected by the user (langmenu or Profile page), not when Czech or German is selected as the main site language in the Configuration->Variables.
What is weird, too, is the fact that the Site News heading is always appearing in its Czech translation, even if English is selected as the language of the site AND the language of the current user.
In reply to Daniel Mikšík

Re: Allowed memory size exhausted

by Daniel Mikšík -
Picture of Core developers Picture of Translators
As others pointed to the workshop module (/mod/workshop/lib.php) causing the fatal error and as I experienced this file to be the trigger for the error at my other testing site, I deleted the workshop module and then everything is OK. It is only a very rough method of narrowing down the problem, I know, but still, maybe a first step?
In reply to Daniel Mikšík

Re: Allowed memory size exhausted

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It might not be the workshop modules, especially as nothing has changed there for a while ... it might just be that the error occurs there because it is the last module to be loaded (starts with w) and the sum total of all the module libraries is getting bigger ... If you aren't using exercise or dialogue try deleting those and it should also fix the problem.

Long term we need to split lib.php in some of these modules, I think.
In reply to Martin Dougiamas

Re: Allowed memory size exhausted

by Daniel Mikšík -
Picture of Core developers Picture of Translators
I tend to agree with your explanation, Martin, the error began to occur even with the English language pack. The workaround for me was to include this line
ini_set('memory_limit', '16M');
in the lib/setup.php file (maybe could go to config.php as well?). Posting it here in hope it helps someone else. DM

In reply to Martin Dougiamas

Re: Allowed memory size exhausted

by Przemyslaw Stencel -
Hi Martin,

I've just upgraded to version 2003103100 and am having a similar problem. At first I couldn't access the existing course. In IE, I got "page cannot be displayed", in Mozilla, I got "the document is null", or something similar (in Polish). I created a brand new course and saw this "allowed memory size exhausted" for /mod/workshop/lib.php on line 2845

Adding an activity or a user does not help.

Now on some occasions I cannot open the course at all, on others I get this error. It seems it's not a php problem, because this is a very small moodle site (my testing installation), with just three, almost empty, courses. At the same time, my main installation (release 1.1.1) is beautifully running on the same machine, even though it is much larger in terms of number of courses, activities and users.

I totally agree that using up 8MB on an empty course is weird - the lib.php file seems to be the culprit here wink

Cheers

PS: I'm using the English language pack
In reply to Przemyslaw Stencel

Re: Allowed memory size exhausted

by Przemyslaw Stencel -
sometimes the error is in line 2316, but the file is the same - /mod/workshop/lib.php

And it takes ages to open the /course/view.php, if it opens at all.

Hope this will help.