[wp-trac] [WordPress Trac] #56390: Updating WP_MEMORY_LIMIT

WordPress Trac noreply at wordpress.org
Thu Aug 18 06:22:12 UTC 2022


#56390: Updating WP_MEMORY_LIMIT
---------------------------+------------------------------
 Reporter:  JavierCasares  |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  General        |     Version:
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:  performance
---------------------------+------------------------------

Comment (by dd32):

 > Why change the WP_MEMORY_LIMIT value?
 >
 > To level it to the PHP standard.
 >
 > If the hoster has some kind of limitation, misconfiguration, an
 incorrect value or does not allow changing it, the value used is the
 lesser, of 40 MB, which usually produces memory errors, when it should use
 the PHP default value [...]

 If I'm understanding this correctly, the real concern here is not that the
 value of 40/64M is too low for WordPress, but rather, that under certain
 systems WordPress may accidentally lower the memory limit from something
 much higher to 40M, correct?

 If that's the case, this seems to be going about it the wrong way, instead
 of changing where the limit comes from, if we can't detect a valid value
 (ie. maybe it's 0?) it should just leave the memory as-is and not change
 anything?

 Based on previous tickets (see below), it seems to me that using
 `ini_get_all()['memory_limit']['global_value']` is mostly irrelevant. Just
 because `global_value` is 1G, doesn't mean we should use that as our
 default.

 As far as I can tell though, this statement should be truthful:
 {{{
 ini_get( 'memory_limit' ) === (
 ini_get_all()['memory_limit']['local_value'] ?:
 ini_get_all()['memory_limit']['global_value'] )
 }}}

 Previously, Duplicate Of, See also, etc: #29341, #52143, #51153, #37680

 https://core.trac.wordpress.org/ticket/52143#comment:3 is interesting
 though, it sounds like `ini_get( 'memory_limit' )` doesn't work on their
 hosting properly, and instead of fixing that they simply make
 `WP_MEMORY_LIMIT` set to the same invalid value so core doesn't do
 anything with it.

 > `memory_get_usage()`

 I'm not sure why that function is even mentioned, that's unrelated to
 memory limits, but rather, it's the amount of memory currently allocated
 to the process (Maximum memory is not allocated to the process unless it's
 using all it's memory limits).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56390#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list