Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Weird grav memory error

Started by Muut Archive 10 years ago · 10 replies · 1077 views
10 years ago

Does anyone know what this error means? How can it overflow memory when i didnt overflow it?

Error:

Whoops\Exception\ErrorException thrown with message "Allowed memory size of 134217728 bytes exhausted (tried to allocate 9830401 bytes)"

Stacktrace:

0 Whoops\Exception\ErrorException in /web/htdocs1/design_reklamacz/home/www/maregs/vendor/gregwar/image/Gre gwar/Image/Adapter/GD.php:85

10 years ago

According to the stack trace, the error is with your GD library. The "tried to allocate" statement simply means that was how much it was trying to allocate when it failed. It doesn't mean that's the total amount of memory consumed at the time of the crash. You definitely exceeded the limit. You'll want to dig more into that library. Maybe you just tried to process an exceptionally large image.

10 years ago

Ok thank you... But i don't have image larger than 3 mb so it is very weird error

10 years ago

Well maybe it's not probelm with the GD library afterall. Because when I delete all the images, the memory usage is whopping 90 mb even for bare page. So there is something else eating memory. Any idea how can I find out what it is?

10 years ago

Maybe I should add that this happens only after clearing cache ... otherwise it is using 2mb

10 years ago

Pages with lots of media can peak at high memory even if the images are not bit (just tried a page we test and got 68MB on the debug bar) at the first load, then get as low as 4MB on the next refreshes, once assets are cached, that's normal. It's not normal if you don't have any image on the other hand. Maybe some plugin doing something?

10 years ago

Well you guys are right after all... I made mistake cause I haven't deleted every image. The problem was one image that had only 3mb on disk (but resolution was close to 6000x4000, so I found out that HugoAvila was right) . I tried deleting images one by one and then found out this. Now everything works as it should. Thanks.

10 years ago

This is likely not just a single large image, but the process Gregwar applies (really GD applies) when manipulating (resizing etc) many of them: It does not handle memory well, in that it does not clear the memory cache consequently, and so a significant amount of memory will be used whereas not all of it would actually be needed.

There are issues on the GitHub repo where solutions to solving this exists, but none are as of yet implemented. Ideally a move away from GD would solve this, as alternative approaches using Imagick or GMagick avoids the problem more gracefully. It remains the case, though, that with any large portion of images you are currently better off resizing them yourself than letting the server do it.

10 years ago

Imagick and other solutions are definitely superior, unfortunately they are not widely supported by hosting providers. Even then, the current image manipulation library we use doesn't support anything but GD. There is an issue open to look into this, but it's a lot of work, and for it to be feasible in Grav 1.X it would need to be backwards compatible.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago