[wp-trac] [WordPress Trac] #14889: Memory Comparison Broken / WordPress Memory Limit

WordPress Trac wp-trac at lists.automattic.com
Mon Jun 6 19:50:05 UTC 2011


#14889: Memory Comparison Broken / WordPress Memory Limit
-----------------------------------------------+---------------------------
 Reporter:  hakre                              |       Owner:
     Type:  defect (bug)                       |      Status:  new
 Priority:  normal                             |   Milestone:  Future
Component:  General                            |  Release
 Severity:  normal                             |     Version:  3.0
 Keywords:  has-patch 3.2-early needs-testing  |  Resolution:
-----------------------------------------------+---------------------------

Comment (by hakre):

 Nice you catched -1, I knew it exsited, but must admit, I never put it
 into thought for the code but indeed it's needed.

 Quickly scanned your last patch, [attachment:chrisbliss18-patch.2.diff].

 What I ran over was the order of m,g,k. First impression was, why not
 g,m,k or k,m,g. However that's detail.

 Another Idea I ran over is because of the duplicate code. I'm aware that
 it's not wanted to introduce a new function (or if, it would made the
 patch stale), so I was thinking about something else than a function - a
 shared map (rough code, exec'ed):

 {{{
 $map = array('g' => 1073741824, 'm' => 1048576, 'k'=> 1024);
 $memory_limit *= isset($map[$unit]) ? $map[$unit] : 1;
 $wp_memory_limit *= isset($map[$wp_unit]) ? $map[$wp_unit] : 1;
 }}}

 Next to that it should be even possible to iterate over both variables
 after init, so to reduce the duplicated code full but that costs an
 iteration (runtime).

 However with the rest I wonder if it can be properly said that if the
 system setting is -1 that it should not be degraded to the setting
 explicity specified. I'm unsure about that, but just wanted to leave the
 note.

 My 2 cents for the latest patch.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14889#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list