Title: High memory usage
Last modified: August 19, 2022

---

# High memory usage

 *  [gregoruplanine](https://wordpress.org/support/users/gregoruplanine/)
 * (@gregoruplanine)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/high-memory-usage-6/)
 * In case there are a lot of posts (in our case ~15.000) PHP runs out of memory(
   in our case 1GB) when trying to retrieve all the posts to list in a dropdown.
   
   Even before this hard crash happened, the “add slide” page was loading awfully
   slow.
 * The problem is in `class-foyer-admin-slide-format-post.php`
 *     ```
       $args = array(
           'post_type' => 'post',
           'posts_per_page' => -1,
       );
   
       $posts = get_posts( $args );
       ```
   
 * I did a quick fix by limiting them to 50.
 * This probably isn’t meant to run on a news site, but there should be a better
   solution, to choose a post for a slide, like something AJAX based.
    -  This topic was modified 3 years, 9 months ago by [gregoruplanine](https://wordpress.org/support/users/gregoruplanine/).

The topic ‘High memory usage’ is closed to new replies.

 * ![](https://ps.w.org/foyer/assets/icon-256x256.png?rev=1752613)
 * [Foyer - Digital Signage for WordPress](https://wordpress.org/plugins/foyer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/foyer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/foyer/)
 * [Active Topics](https://wordpress.org/support/plugin/foyer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/foyer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/foyer/reviews/)

 * 0 replies
 * 0 participants
 * Last reply from: [gregoruplanine](https://wordpress.org/support/users/gregoruplanine/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/high-memory-usage-6/)
 * Status: not resolved