WordPress.org

Make WordPress Core

Opened 20 months ago

Closed 19 months ago

Last modified 19 months ago

#21646 closed enhancement (fixed)

Bump memory limit from 32MB

Reported by: nacin Owned by: 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)

comment:1 nacin20 months ago

  • Description modified (diff)

comment:2 wonderboymusic20 months 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.

comment:3 ryansatterfield20 months 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 20 months ago by ryansatterfield (previous) (diff)

comment:4 ryansatterfield20 months ago

  • Component changed from Blog by Email to Performance

comment:5 wonderboymusic20 months 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.

comment:6 nacin20 months 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.

comment:7 wonderboymusic20 months 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.

comment:8 ryansatterfield20 months ago

I apologize for the mistake. Shouldn't Wordpress be less bloated when it changes to PDO? It should be less bloated in 5.0, so could 48/64 be considered a temporary fix?

Version 0, edited 20 months ago by ryansatterfield (next)

comment:9 nacin19 months 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.

comment:10 alexvorn219 months ago

I set once 2024MB memory limit and It was fine

Note: See TracTickets for help on using tickets.