Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#21646 closed enhancement (fixed)

Bump memory limit from 32MB

Reported by: nacin's profile nacin Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: trivial Version: 3.0
Component: Performance Keywords: 2nd-opinion
Focuses: Cc:

Description (last modified by nacin)

On some shared hosts and servers, WordPress runs perilously close to 32MB in the dashboard, especially with a number of plugins included. It's time to bump. I am thinking 40MB as a good, relatively round number.

In the near future (once our minimum PHP version is 5.3, and possibly earlier for those already on 5.3), we can look into autoloading of all of our classes. That should take down our memory a bit. (kurtpayne has looked and it's not much, mainly because so many of them are used on most pages.)

Note that increasing the memory limit does not actually result in 8 more megabytes of memory being used. WordPress won't start eating up that memory — just that PHP allows the script to use up to 40MB. Otherwise, hitting 32 would give a fatal error.

We also should not take this as a license to further increase the side of the WordPress codebase, which has crept up at a pretty steady pace over the years. The only objective is to avoid fatal errors on individual sites.

Change History (10)

#1 @nacin
12 years ago

  • Description modified (diff)

#2 @wonderboymusic
12 years ago

PHP 5.4's default dev and prod .ini files have memory_limit = 128M.

Since the purpose of WP_MEMORY_LIMIT is to ini_set, I don't think we have to be so modest. I'm not sure what the default is for 5.2.6, but it was 8M before PHP 5.2.0 and 16M in PHP 5.2.0.

Also, since PHP 5.2.1, --enable-memory-limit no longer has to be set at compile time to be able to ini_set the values.

#3 @ryansatterfield
12 years ago

  • Component changed from Performance to Blog by Email
  • Keywords close 2nd-opinion added
  • Severity changed from normal to trivial
  • Type changed from enhancement to feature request
  • Version set to 3.4.2

I don't believe this is a Wordpress issue. You need to make a php.ini file and put the following line of code inside of it memory_limit = 40M

Last edited 12 years ago by ryansatterfield (previous) (diff)

#4 @ryansatterfield
12 years ago

  • Component changed from Blog by Email to Performance

#5 @wonderboymusic
12 years ago

  • Keywords close removed
  • Type changed from feature request to enhancement
  • Version changed from 3.4.2 to 3.0

99% of blogs that use WordPress have no clue what PHP and memory are, and have no access to php.ini. Because of that, WordPress tries to override memory_limit with an ini_set call, which is currently done using the WP_MEMORY_LIMIT constant at runtime. 32M is 1/4 the default limit PHP recommends in version PHP 5.4.

#6 @nacin
12 years ago

ryansatterfield: WordPress sets a default memory limit for the application in wp_initial_constants().

wonderboymusic: Maybe 48MB? Anything beyond that seems unnecessary even if just from a PR standpoint. (WordPress is bloated, WordPress hogs memory, etc.)

Should multisite change from 64MB, or is that sufficient?

Note that wp_initial_constants() only sets a memory limit if the current memory limit is lower than what we need.

#7 @wonderboymusic
12 years ago

48/64 should be fine for 90% of installs - once you get to anything resembling scale, it is really easy to exhaust memory. Just doing modest performance testing with no object cache, things can wipe out quickly. I guess for people who need performance, we should assume they know how to tweak their server(s) and leverage Memcached, etc.

#8 @ryansatterfield
12 years ago

I apologize for the mistake. Shouldn't Wordpress 5.0 be less bloated since it is changing to PDO? Could 48/64 be considered a temporary fix?

Last edited 12 years ago by ryansatterfield (previous) (diff)

#9 @nacin
12 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [21809]:

Bump default memory limit from 32MB to 40MB. fixes #21646.

#10 @alexvorn2
12 years ago

I set once 2024MB memory limit and It was fine

Note: See TracTickets for help on using tickets.