Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#17083 closed defect (bug) (invalid)

Users experiencing fatal memory errors in various activities

Reported by: bennebw's profile bennebw Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: General Keywords:
Focuses: Cc:

Description

A number of users have been reporting on blogs and in the WP forum that they are getting fatal memory errors when upgrading to WP 3.1.1 or upgrading plugins, also in some image resizing situations.

I experienced this on several sites while upgrading to WP 3.1.1. My host has a memory limit of 256MB and the error message I got said it was trying to allocate around 30MB. When I deactivated a couple of plugins, everything went fine.

I did a quick search of WP 3.1 and found the following lines in wp-includes/default-constants.php:

// set memory limits
	if ( !defined('WP_MEMORY_LIMIT') ) {
		if( is_multisite() ) {
			define('WP_MEMORY_LIMIT', '64M');
		} else {
			define('WP_MEMORY_LIMIT', '32M');
		}
	}

So, it looks like for single blog sites (non-MU), that is setting a constant for 32M. Could this be the root of why folks are blowing memory even if they've got 256MB from the host?

Change History (4)

#1 follow-up: @dd32
14 years ago

  • Keywords reporter-feedback added

The WordPress Admin sets the memory limit to 256M if it can for expensive operations (Upgrades and Image editing).

The rest of WordPress runs on 32M for single-site and 64M for multisite like you've noticed.

A few lines down from that, you'll find it's only set to 32/64M if thats greater than the current memory limit (Note: If you express the php memory limit in Gigabytes, you'll run into #14889)

I'd be questioning what the memory limit is -really- set to.. try phpinfo(); in it's own file and check what the memory_limit claimed there is? or add echo init_get('memory_limit'); to your wp-config.php file temporarily to check what the actual PHP value is before WordPress loads.

#2 in reply to: ↑ 1 ; follow-up: @bennebw
14 years ago

  • Keywords close added; reporter-feedback removed
  • Resolution set to wontfix
  • Status changed from new to closed

Replying to dd32:

Thanks for the suggestions. I tried both methods and get 40M for the memory_limit using the phpinfo and ini_get methods. The 256M I saw was probably due to the WP Admin change that you mentioned above.

I tried a little debugging by re-installing WP 3.1.1, and it wasn't bombing out. So I activated a bunch of plugins and was able to get it to crash and give this message:

Fatal error: Out of memory (allocated 29622272) (tried to allocate 3096504 bytes) in /homepages/38/d151202375/htdocs/pixoox/wp-includes/class-http.php on line 1426

So, from that message, I'm guessing it's trying to allocate a total of 29.6M + 3M or around 32.6M all total. Is that right? If so, then you'd expect it to be ok if the memory limit is 40M. (I also put the ini_get('memory_limit') in the default-constants.php file after the conditional setting of the memory limit that you mentioned above and it still showed 40M as expected.

It's definitely not the WP_MEMORY_LIMIT item. I didn't see any other ini_set('memory_limit') calls in a search of the WP code that looked like it would cause it to set it lower than the 256.

Not sure what gives, but it is a head scratcher for me. All the same, a simple workaround is to deactivate a few plugins and do the upgrade, and drive on.

Thanks again for taking a look.

Byron

#3 in reply to: ↑ 2 @ocean90
14 years ago

  • Keywords close removed
  • Resolution wontfix deleted
  • Status changed from closed to reopened

Replying to bennebw:

All the same, a simple workaround is to deactivate a few plugins and do the upgrade, and drive on.

Or ask your host, if he can increase your memory limit or define WP_MEMORY_LIMIT.

#4 @ocean90
14 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.