WordPress.org

Forums

Should I Increase Memory in My Plugin? (3 posts)

  1. Allen
    Member
    Posted 2 years ago #

    Hi,
    I wrote a plugin that's been out for about 1 year and now doing some testing on an upgrade on my local machine. Out of the blue, I just started getting this error (not as a result of any coding change or adding plugins)

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 80 bytes) in /Users/me/Dropbox/My Webs/wordpress/wp-includes/class-simplepie.php on line 14866

    Asking users to increase their memory doesn't make sense since plugin users aren't always that tech savvy.

    So, I'm wondering if I can do this for them by adding something like

    (‘WP_MEMORY_LIMIT’, ’128M’)

    But is this ok to do..meaning changing their wordpress memory limit just for my plugin? Is there something else you'd suggest?

    Thanks,
    Allen

  2. Ayman
    Member
    Posted 2 years ago #

    Using

    (‘WP_MEMORY_LIMIT’, ’128M’)

    will limit the whole website... So why don't you try this:
    Put this line of code in the main file of your plugin so when the plugin runs will load the limits directly.
    ini_set('memory_limit', '128M');

  3. Allen
    Member
    Posted 2 years ago #

    Thanks Ayman...will need to think about this since I've seen on some other sites that increasing the memory is bad form for wordpress plugin developers...might need to do this on a case by case basis when a user has a problem.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags