Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Memory Allocation Errors


Reply


8 Posts   2404 Views

Avatar
AndrewR

Community Member, 5 Posts

11 May 2009 at 8:08pm

I've just installed SilverStripe to my host (InMotion Hosting), and after some fussing around I have got to the point where I can log into the CMS. However both the CMS pages and the actual site pages are giving intermittent memory allocation errors.

Example of a page rendered from the site (actually the default home page), where the memory error is being added after the closing html tag.

</html>
<br />
<b>Fatal error</b>: Allowed memory size of 268435456 bytes exhausted (tried to allocate 480634800 bytes) in <b>Unknown</b> on line <b>0</b><br />

A similar message shows up in the CMS next to the Save/Publish/Unpublish buttons:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 435247024 bytes) in Unknown on line 0

According to phpinfo() max_memory is set to 256M, so if my understanding of the docs is correct then I shouldn't have a problem. So I suspect I've stuffed something in the installation...

Any suggestions on where to start looking?

Environment is:
Apache 2.2.11
PHP 5.2.9
MySQL 5.0.67

Avatar
AndrewR

Community Member, 5 Posts

14 May 2009 at 9:26pm

Well, it gets stranger.

Adding an "echo memory_get_usage()" to the end of sapphire/main.php results in showing an acceptable amount of memory used. Much lower than the limit set.

But the fatal error is still reported afterwards. Thing is, the echo statement is right at the end of main.php, so there really shouldn't be anything else happening afterwards? Also, its not happening consistently. Maybe once out of every 3 pageviews - both in the actual site and using the CMS.

I've tried re-uploading the SS distribution, with no effect.

As a beginner SS user, this is puzzling - any suggestions from more experienced users?

Avatar
AndrewR

Community Member, 5 Posts

23 May 2009 at 10:17pm

Well, sad to say I've given up and switched to Drupal.

If anyone out there has Silverstripe running on InMotionHosting, I would be very interested in having a chat.

Avatar
Willr

Forum Moderator, 5513 Posts

25 May 2009 at 4:51pm

You are running 32mb - this is the minimum requirement to run a basic site. I suggest tho you run it at least 64mb ideally 128mb to run some of the more complex operations will chew through 32mbs quite easily

Avatar
AndrewR

Community Member, 5 Posts

25 May 2009 at 5:19pm

Thanks for the response, but I am not sure how this can be so.

php.ini has it set to 256M:

memory_limit = 256M ; Maximum amount of memory a script may consume (32MB)

And phpinfo reports:

memory_limit 256M

Further, the error message being appended to the page is saying that the script has exhausted 268435456 bytes already, which is 256Mb.

So I am unsure why you're saying there's only 32Mb running? Can you point me towards whatever else I should be looking at?

Avatar
Willr

Forum Moderator, 5513 Posts

25 May 2009 at 5:26pm

256M I believe could be 256 Mega Bits rather then Mega Bytes. Note that in the php.ini comment it has MB (32MB) and you have only used M. 256 mega bits = 32 mega bytes.

Avatar
AndrewR

Community Member, 5 Posts

26 May 2009 at 12:47am

Will,

Thanks again for the suggestion. I checked the PHP documentation, which says:

The available options are K (for Kilobytes), M (for Megabytes) and G (for Gigabytes; available since PHP 5.1.0), these are case insensitive. Anything else assumes bytes. 1M equals one Megabyte or 1048576 bytes. 1K equals one Kilobyte or 1024 bytes. You may not use these shorthand notations outside of php.ini, instead use an integer value of bytes. See the ini_get() documentation for an example on how to convert these values.

Further, the error message (see original post at the top) says that the total allocated memory of 256 megabytes (268,435,456 bytes) has been exhausted. So I am fairly confident that I do actually have 256MB (not megabits) configured (and used).

Avatar
Willr

Forum Moderator, 5513 Posts

26 May 2009 at 11:39am

Well the default installation should really not be consuming anywhere near 256mb of Ram. I think your investigations with memory_usage and the fact that it throws the error on an unknown file is really strange! Could be PHP getting itself in a bit of a loopy state. Whats your php configuration / apache module setup? You said in your first post you needed to fuss around to get it to install. Did the installer throw any warnings?