Title: Fatal Error &#8212; Allocated Memory
Last modified: August 21, 2016

---

# Fatal Error — Allocated Memory

 *  Resolved [packgrad2k1](https://wordpress.org/support/users/packgrad2k1/)
 * (@packgrad2k1)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/)
 * Good news first… I ran the plugin once without any issues, and was able to free
   up 900mb+ of old files in 12,068 image files. Yay!
 * When I try to re-run the plugin now, however, I get a fatal error. Below is the
   full output of the log file. Any idea what’s going on? I’ve tried updating PHP
   memory in wp-config.php to be 64, then 96mb, but no change. Thanks in advance!
 * –Mike
 * [0.0046] Info: WP_Query results written to log
    [0.0000] Registered sizes: [“
   thumbnail”,”medium”,”large”,”full”] [0.0001] Meta indexed so far: 1 / 636 [0.0005]
   Sample meta: {“width”:1080,”height”:720,”file”:”2013\/12\/BellonBaptism_0421.
   jpg”,”sizes”:{“thumbnail”:{“file”:”BellonBaptism_0421-180×180.jpg”,”width”:180,”
   height”:180,”mime-type”:”image\/jpeg”},”medium”:{“file”:”BellonBaptism_0421-700
   ×466.jpg”,”width”:700,”height”:466,”mime-type”:”image\/jpeg”},”large”:{“file”:”
   BellonBaptism_0421-800×533.jpg”,”width”:800,”height”:533,”mime-type”:”image\/
   jpeg”}},”image_meta”:{“aperture”:0,”credit”:””,”camera”:””,”caption”:””,”created_timestamp”:
   0,”copyright”:””,”focal_length”:0,”iso”:0,”shutter_speed”:0,”title”:””}} [0.0000]
   Meta indexed so far: 51 / 636 [0.0000] Meta indexed so far: 101 / 636 [0.0000]
   Meta indexed so far: 151 / 636 [0.0000] Meta indexed so far: 201 / 636 [0.0000]
   Meta indexed so far: 251 / 636 [0.0000] Meta indexed so far: 301 / 636 [0.0000]
   Meta indexed so far: 351 / 636 [0.0000] Meta indexed so far: 401 / 636 [0.0000]
   Meta indexed so far: 451 / 636 [0.0000] Meta indexed so far: 501 / 636 [0.0000]
   Meta indexed so far: 551 / 636 [0.0000] Meta indexed so far: 601 / 636 [0.0207]
   Meta indexed so far: 636 / 636 [0.0231] Info: Valid and Invalid meta results 
   written to log [0.0157] Info: Loaded attachments to memory [48.25 mb] [0.0659]
   Info: 2294 Images found [50.25 mb] [0.1523] Info: 103 Invalid images found [50.5
   mb] [0.1659] Info: Retrieved attachment images from DB [48 mb] [0.2496] Info:
   Backup meta results written to log [48 mb] [0.0004] Posts checked for used images
   1/149 [0.0004] Posts checked for used images 51/149 [0.0003] Posts checked for
   used images 101/149 [0.0157] Info: Invalid post image meta results written to
   log [0.0397] Info: Invalid script image meta results written to log [0.3973] 
   Info: Invalid referenced image meta results written to log [0.0000] Uknown error:
   Please see returned value below
 * <b>Fatal error</b>: Allowed memory size of 67108864 bytes exhausted (tried to
   allocate 59 bytes) in <b>/home/pittmanp/public_html/wp-content/plugins/image-
   cleanup/image-cleanup.plugin.php</b> on line <b>1842</b>
 * [http://wordpress.org/plugins/image-cleanup/](http://wordpress.org/plugins/image-cleanup/)

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

 *  Plugin Author [opicron](https://wordpress.org/support/users/opicron/)
 * (@opicron)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4403930)
 * Good find! I have updated the plugins repository code and optimized memory usage
   in that specific function.
 * Would you please be so kind to de-install and re-install the plugin? I have not
   updated the version (yet).
 *  Plugin Author [opicron](https://wordpress.org/support/users/opicron/)
 * (@opicron)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4403932)
 * By the way, the reason the plugin did not fail on the initial run is because 
   of the fact that when it finds a lot (12068 images is quite a lot) it skips the
   function to find if these images still have links to some leftover metadata in
   the wordpress database.
 * Do note that these images are being checked against all possible metadata wordpress
   knows how to find on its own. There are some cases when there needs to be a low-
   end function to find leftover attachment data.
 * Rest assured that even if some of these files still had metadata coupled in the
   database wordpress already did not know how to find it back unless you re-instated
   the different previous registered image sizes.
 * The code to find these leftovers is quite tough and will only run if there are
   less than 500 incorrect images. I am in the process of re-thinking this approach
   to also clean up the database a bit.
 * However at the moment I think that the impact of saving 900mb was more important
   than a few megabytes (at most) in the database.
 *  Thread Starter [packgrad2k1](https://wordpress.org/support/users/packgrad2k1/)
 * (@packgrad2k1)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4403959)
 * Sorry it took so long to get this done! I tried uninstalling and re-installing,
   and still get the same result (log file pasted below again).
 * You are correct, however, that saving the 900mb was huge. I was approaching my
   2gb limit and couldn’t figure out why, especially as much effort as I put into
   keeping images below 200k! This plugin is a life saver. 😀
 * [0.0047] Info: WP_Query results written to log
    [0.0000] Registered sizes: [“
   thumbnail”,”medium”,”large”,”full”] [0.0001] Meta indexed so far: 1 / 636 [0.0008]
   Sample meta: {“width”:1080,”height”:720,”file”:”2013\/12\/BellonBaptism_0421.
   jpg”,”sizes”:{“thumbnail”:{“file”:”BellonBaptism_0421-180×180.jpg”,”width”:180,”
   height”:180,”mime-type”:”image\/jpeg”},”medium”:{“file”:”BellonBaptism_0421-700
   ×466.jpg”,”width”:700,”height”:466,”mime-type”:”image\/jpeg”},”large”:{“file”:”
   BellonBaptism_0421-800×533.jpg”,”width”:800,”height”:533,”mime-type”:”image\/
   jpeg”}},”image_meta”:{“aperture”:0,”credit”:””,”camera”:””,”caption”:””,”created_timestamp”:
   0,”copyright”:””,”focal_length”:0,”iso”:0,”shutter_speed”:0,”title”:””}} [0.0000]
   Meta indexed so far: 51 / 636 [0.0000] Meta indexed so far: 101 / 636 [0.0000]
   Meta indexed so far: 151 / 636 [0.0000] Meta indexed so far: 201 / 636 [0.0000]
   Meta indexed so far: 251 / 636 [0.0000] Meta indexed so far: 301 / 636 [0.0000]
   Meta indexed so far: 351 / 636 [0.0000] Meta indexed so far: 401 / 636 [0.0000]
   Meta indexed so far: 451 / 636 [0.0000] Meta indexed so far: 501 / 636 [0.0000]
   Meta indexed so far: 551 / 636 [0.0000] Meta indexed so far: 601 / 636 [0.0259]
   Meta indexed so far: 636 / 636 [0.0286] Info: Valid and Invalid meta results 
   written to log [0.0156] Info: Loaded attachments to memory [48.25 mb] [0.0773]
   Info: 2831 Images found [50.75 mb] [0.1727] Info: 640 Invalid images found [51
   mb] [0.1950] Info: Retrieved attachment images from DB [49.25 mb] [0.2656] Info:
   Backup meta results written to log [49.25 mb] [0.0022] Posts checked for used
   images 1/149 [0.0022] Posts checked for used images 51/149 [0.0021] Posts checked
   for used images 101/149 [0.1709] Info: Invalid post image meta results written
   to log Warning: skipping script index because of too many image files [0.0021]
   Warning: skipping attachment index because of too many image files [0.0000] Uknown
   error: Please see returned value below
 * <b>Fatal error</b>: Allowed memory size of 67108864 bytes exhausted (tried to
   allocate 32 bytes) in <b>/home/pittmanp/public_html/wp-content/plugins/image-
   cleanup/image-cleanup.plugin.php</b> on line <b>1852</b>
 *  Plugin Author [opicron](https://wordpress.org/support/users/opicron/)
 * (@opicron)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4403971)
 * No worries, take all the time you need. I need to rewrite a small part of the
   plugin to take care of the memory issue here.
 * I already know how to fix it but now I have to find the time. Hoping that I will
   be able to work on it this or tomorrow evening.
 *  Thread Starter [packgrad2k1](https://wordpress.org/support/users/packgrad2k1/)
 * (@packgrad2k1)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4403972)
 * Works for me! Your plugin cleaned up 900mb of images with no ill side effects,
   so as far as I’m concerned, you’re my hero. 🙂 When you have a new version to
   test, let me know and I’ll gladly be your guinea pig should you need one.
 *  Plugin Author [opicron](https://wordpress.org/support/users/opicron/)
 * (@opicron)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4403974)
 * Most of the plugin has been rewritten now. But it will take some time check all
   functionality.
 *  Plugin Author [opicron](https://wordpress.org/support/users/opicron/)
 * (@opicron)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4403998)
 * A new version of the plugin has been released. I hope it will fix the troubles
   you have been facing.
 *  Thread Starter [packgrad2k1](https://wordpress.org/support/users/packgrad2k1/)
 * (@packgrad2k1)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4404003)
 * That did it! Thanks so much for saving my a$$. 😀 Fantastic plugin.
 *  Plugin Author [opicron](https://wordpress.org/support/users/opicron/)
 * (@opicron)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4404004)
 * Thanks for trying! You are most welcome. Please, if you find the time, you might
   be able to write a review ;).
 *  Thread Starter [packgrad2k1](https://wordpress.org/support/users/packgrad2k1/)
 * (@packgrad2k1)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4404005)
 * No doubt on the review! Already penning it as you sent this. 🙂
 *  [wplamp](https://wordpress.org/support/users/wplamp/)
 * (@wplamp)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4404017)
 * I just had similar errors to what packgrad2k1 was having on a site, I ended up
   bumping the php memory on the vps up to 512mb per script.
 * Deleted 13,673 unused images and over 700mb of disk space. 🙂
 * Thanks very much for all of your work and I’ll leave a review right now.

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

The topic ‘Fatal Error — Allocated Memory’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/image-cleanup_e2e2e2.svg)
 * [Image Cleanup](https://wordpress.org/plugins/image-cleanup/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/image-cleanup/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/image-cleanup/)
 * [Active Topics](https://wordpress.org/support/plugin/image-cleanup/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/image-cleanup/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/image-cleanup/reviews/)

## Tags

 * [allocated](https://wordpress.org/support/topic-tag/allocated/)
 * [fatal error](https://wordpress.org/support/topic-tag/fatal-error/)

 * 11 replies
 * 3 participants
 * Last reply from: [wplamp](https://wordpress.org/support/users/wplamp/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/fatal-error-allocated-memory/#post-4404017)
 * Status: resolved