[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 05:00:47 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 | Keywords:
Focuses: |
--------------------------+-----------------------------
When calling `wp_cache_init()` repeated in unit testing the
WP_Object_Cache::__contruct() repeatedly registers '__destruct' as a
shutdown function, and each time it does it leaks memory.
There is a @todo comment above the `register_shutdown_hook()` that says
the following so I would assume that this is no longer needed and we could
just delete the line with the register_shutdown_hook()?
''This should be moved to the PHP4 style constructor, PHP5 already calls
__destruct()''
I will upload a patch to delete the list, and a different patch to only
call `register_shutdown_hook()` once, depending on what is appropriate.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44445>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list