[wp-trac] [WordPress Trac] #44445: wp_cache_init() and WP_Object_Cache constructor has a memory leak

WordPress Trac noreply at wordpress.org
Sun Jun 24 14:03:33 UTC 2018


#44445: wp_cache_init() and WP_Object_Cache constructor has a memory leak
--------------------------+------------------------------
 Reporter:  MikeSchinkel  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Cache API     |     Version:  4.9.6
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |     Focuses:  performance
--------------------------+------------------------------
Changes (by ayeshrajans):

 * keywords:   => dev-feedback
 * focuses:   => performance


Comment:

 The destructor simply returns true and doesn't clean up anything that
 could've prevented the said memory leak. Even the oldest state of
 cache.php file I could find (https://github.com/WordPress/wordpress-
 develop/blob/b43712e0f79a9f5bea52217e06155e2f471c490c/src/wp-
 includes/cache.php, oldest checkout available 5 years ago) has the exact
 same code. I'm pretty sure this is dead code, which we should probably
 remove from the root.

 With the `__destruct` and shut down function registration removed, the
 test suite still passes: https://travis-ci.org/Ayesh/wordpress-
 develop/builds/396071330

 I will attach the patch for reference.

 With the patch applied, PHP 7.1 test suite completed the execution and
 memory usage statistics from PHPUnit are identical when compared to a
 Travis results before the patch (https://travis-ci.org/Ayesh/wordpress-
 develop/jobs/396068504)

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


More information about the wp-trac mailing list