• Resolved Tatiane Pires

    (@tatianeps)


    I wrote two plugins (“mu-plugins” to be more accurate) to create widgets: one display posts of the selected category, the other lists the recent posts. The widgets have several options like display excerpt, display image and so on.

    But these plugins might be causing “Out of Memory” issues.

    The plugins are very similar, and their codes are on the following pasebin links:
    widget-list-posts-of-category.php
    widget-list-recent-posts.php

    I need some help on this. How do I check for memory related issues?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Dion

    (@diondesigns)

    The image_downsize() function is extremely memory-intensize if it must manually resize an image. My suggestion is that you write a custom version of the function which rejects images that have no thumbnails.

    Alternately, you could add this line to the top of your tps_recent_posts_html() function:

    @ini_set('MEMORY_LIMIT', '256M');

    Be aware that this could cause other issues, so the first option is best.

    Thread Starter Tatiane Pires

    (@tatianeps)

    When I first notice the memory issue on the server, I added the following to wp-config.php:
    `define(‘WP_MEMORY_LIMIT’, ’64M’);

    I actually did notice that Chromium (browser) was using a lot of memory while developing the plugin on my localhost environment. However I though it was a browser issue, I didn’t realize it was because of the code I was writing.

    I didn’t know that image_downsize() used so much memory. Thanks, DionDesigns! Now I’m using wp_get_attachment_image() instead.

    I’ll take off the pastebins. Later on I’ll write on my blog about the plugins, then I’ll release the code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to check if a plugin is causing "Fatal error: Out of memory" issues?’ is closed to new replies.