[wp-trac] [WordPress Trac] #21098: Out of memory errors in XML-RPC
WordPress Trac
wp-trac at lists.automattic.com
Sun Jul 1 16:11:54 UTC 2012
#21098: Out of memory errors in XML-RPC
---------------------------------+------------------------------
Reporter: koke | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: XML-RPC | Version: 3.4
Severity: major | Resolution:
Keywords: mobile dev-feedback |
---------------------------------+------------------------------
Comment (by maxcutler):
It turns out that most of the memory usage comes from the `include`'d code
and not the actual data being acted upon (unless you request an extremely
large number of items).
Example: On my machine, after `wp-load.php` is `include`'d, the memory
usage is about 23MB. `xmlrpc.php` then `include`s `wp-
admin/includes/admin.php`, `class-IXR.php`, and `class-wp-xmlrpc-
server.php` which boosts memory usage up to ~30MB. Most typical XML-RPC
methods only add 0.5-1.5 MB on top of that.
If you look, `wp-admin/includes/admin.php` actually loads a bunch of other
files. This is needed because the server uses `has_meta`,
`wp_generate_attachment_metadata`, `wp_create_category` and similar
methods. You can cut memory usage by half (7MB→3.5MB) by only including
`wp-admin/includes/{post,taxonomy,image}.php`. We could save even more if
the needed functions were moved elsewhere and we could avoid the other
code in those files (e.g., `post.php` is pretty large).
By comparison, removing all of the legacy methods (everything not in the
wp.* namespace) only saves about 0.7MB.
So if we could either move functions around so less code has to be
`include`'d or else change which functions we use in the XML-RPC server,
then we could potentially save substantial amounts of memory. And there
are probably memory savings to be had in that 23MB baseline from the load
process, but that's for another ticket.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21098#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list