[wp-trac] [WordPress Trac] #44523: Huge hemory consumption

WordPress Trac noreply at wordpress.org
Thu Jul 5 14:41:30 UTC 2018


#44523: Huge hemory consumption
--------------------------+-----------------------------
 Reporter:  vijantis      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  4.9.6
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello,

 we have some serious memory issues with the website
 http://test8.transinformation.net.
 The site is a large community, and has plenty posts and comments etc.
 With certain content we **exceed the 256MB limit**. This happens e.g.
 after a successfull login.
 (This subdomain is for the new theme relaunch, but contains a copy of all
 data. The live site also has this issue from time to time)

 By adding debug functions before and after database calls to detect
 significant memory increases (this is where the website "chrashed" first),
 there is a huge increase of the memory usage after certain database
 queries.

 **See attached file.**

 Disabling the _prime_comment_caches in _prime_comment_caches helps a bit,
 getting the page to render, but peak memory usage is high with **206 MB**.

 Disabling the get_comments call in custom_functions helps, getting the
 page to render with a peak memory usage of **145 MB**.
 The code here is pretty simple, and should not cause any memory leaks,
 except maybe for the "separate_comments" function:
 {{{#!php
 function et_comment_count( $count, $post_id ) {
         $is_doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX ? true :
 false;

         if ( ! is_admin() || $is_doing_ajax ) {
                 global $id;
                 $post_id = $post_id ? $post_id : $id;
                 $get_comments = get_comments( array('post_id' => $post_id,
 'status' => 'approve') );
                 $comments_by_type = separate_comments( $get_comments );
                 return count( $comments_by_type['comment'] );
         } else {
                 return $count;
         }
 }
 }}}

 Best regards
 Jan Vorel

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44523>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list