Title: PHP Memory Questions
Last modified: August 30, 2016

---

# PHP Memory Questions

 *  [betamax](https://wordpress.org/support/users/betamax/)
 * (@betamax)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/php-memory-questions/)
 * Hey!
 * My webhosting package has 128MB of RAM (memory_limit) but every time I publish
   or update an article, it says “memory limit exhausted”. I do know what this message
   means, but that is not the question.
 * My website is about 6 years old, but there are only very few plugins, so I don
   ´t know why it is using that much RAM. Even more funny: I have installed a “clean”
   version of wordpress and imported all posts, using the same theme and installed
   the same plugins: it runs without problems and without any memory errors.
 * So why is there a memory error on the 5 year old site (updated regularly) and
   why is the clean install running perfectly? What would you recommend to solve
   the problem? I don´t want to buy a better server with a higher memory limit, 
   I want to solve the issue 🙂
 * Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [David Alcaraz](https://wordpress.org/support/users/damses/)
 * (@damses)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/php-memory-questions/#post-6593438)
 * Hello,
    Try this: Edit you index.php wordpress file and this at first line: ini_set(‘
   memory_limit’, ‘-1’);
 * Regards
 *  [jack randall](https://wordpress.org/support/users/theotherlebowski/)
 * (@theotherlebowski)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/php-memory-questions/#post-6593443)
 * also, if you’re on a shared server then you’re not the only one using all the
   RAM. check with your host to see what’s going on, it may be that there’s another
   site that’s hogging the system resources leaving you with the scraps…
 *  [MarkRH](https://wordpress.org/support/users/markrh/)
 * (@markrh)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/php-memory-questions/#post-6593444)
 * I use this in my theme’s **functions.php** file:
 *     ```
       function memory_stats()
       { // BEGIN function memory_stats
             echo '<p style="clear: both;">Memory used: '. number_format(memory_get_usage(true)). ' bytes.<br />';
             echo 'Peak Memory used: '. number_format(memory_get_peak_usage(true)).' bytes.</p>';
   
       } // END function memory_stats
   
       add_action('in_admin_footer', 'memory_stats');
       ```
   
 * This will tell you how much memory you are using at the bottom of your Dashboard.
   You can also call memory_stats() in your theme’s **footer.php** to see how much
   the front-end is using.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP Memory Questions’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 4 participants
 * Last reply from: [MarkRH](https://wordpress.org/support/users/markrh/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/php-memory-questions/#post-6593444)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
