595 points · by zdw · 5y ago · 329 comments
Ristretto: 48.8MB. EOG: 51.3MB. ImageMagick: 169MB. Firefox: 305.1MB. Vivaldi: 185.2MB. Edge: 196.5MB. GIMP: 244.8MB.
OS memory usage remained relatively flat once app exited. xUbuntu 20.04.
It at least causes ImageMagick to explode, and generally anything that tries to flatten out the GIF into full canvas-sized frames.
I wouldn't be surprised if some poorly implemented players were built on top of abstraction layers that end up flattening the whole thing too and also break, but browsers at least generally do it right.
Btw. many people don't seem to know, that also in languages with a garbage collector like Javascript, you can create awesome memory leaks. And I would bet, most websites actually do: it only works, like it works, because websites are closed regulary. And because RAM is every increasing. But browse with a older smartphone and you hit the RAM limit very quickly.
I think Discord implemented some measures to guard against those files and Chromium was patched to mitigate this (which is why Edge and Vivaldi are fine), so it's not surprising that something like Safari might struggle with Evil GIFs under certain circumstances as well.
https://forums.flyingmeat.com/t/memory-consumption-when-open...
Gus Mueller (the author of the linked tweet) is the author of the Acorn image editor.
> I’ve narrowed it down quite a bit (and submitted it to Apple as FB9112835).
> What’s going on is that the IOAccelerator framework has some sort of massive leak in it, where it’s using up 35GB of ram, 25 of which is going to swap (which is why you’re seeing kernel_task flake out).
> On intel, the same image only uses 1480K from IOAccelerator.
As for actual CPU architectures, there are only two that really matter at the moment: x86/AMD64 and ARM. It's of course very cool that ARM has proved itself flexible enough to be used from (almost) the smallest embedded devices to supercomputers (not to mention Apple M1), but there's not that much diversity as there was in the 80s either...
RISC-V is open source which is great in some respects but also not helpful in others.
https://www.eejournal.com/article/whats-inside-apple-silicon...
Can you provide some more information on this? I would love to be able to hit them on this, as this would actually be really upsetting to a lot of people I know who work on toolchains.
Proprietary software is probably the main reason we haven't had a whole lot of diversity in ISAs over the past couple of decades (see: Itanium). It's no coincidence that ARM's mainstream explosion is tied to Linux (be it GNU/ or Android/).
A ton of ARM hardware is embedded cores running VxWorks or EmBed. M0 through M4. Yes, Phones are the dominant core consumer here, but there is a whole bunch of embedded/IoT stuff shipping ARM cores every day that will never see Linux installed.
Right up until you see someone run Doom on it.
Though you are correct, a lot of abstraction today makes things portable in ways that in the past they were not. The abstraction has a small performance and memory cost which wouldn't have been acceptable now, but today it is in the noise (cache misses are much more important and good abstractions avoid them)
This is not true, compilers don’t generate super-optimized asm output from C. It’s actually not that optimizable because eg the memory access is too low level so there are aliasing issues.
But optimizing doesn’t actually help most programs on modern CPUs so it’s not worth improving this.
Today I do things in a half-an-hour with Python that would have taken me days - maybe weeks! - to accomplish in 1978.
Each little vendor had their own janky tooling. Compilers cost hundreds of 1970s dollars (until Borland's $49 Turbo Pascal, over $150 in today's money).
Don't get me wrong. I was very unhappy when Intel dominated everything. The fact that ARM, an open-source architecture, is now eating Intel's lunch makes me happy.
But I'd honestly be glad if everyone just settled on ARM and were done with it. It was fun messing with all these weird processors (my first team leader job was writing an operating system for a pocket computer running the 65816 processor!) but it meant that actually generating work was very slow.
>The fact that ARM, an open-source architecture
ARM is in no way open, it's fully proprietary. Unlike x86 it is not vertically integrated and is available for anyone to license all the way to the architectural level, and that's huge. But said licenses certainly are not free either, nor Free.
There are promising actual open architectures, in particular OpenPOWER and RISC-V come to mind as interesting with a lot of solid work behind them. So that's one small remaining opening IMO, even if it's more work on the dev side I wouldn't mind having those stick around and get more competitive.
For example, Huawei's Kirin NPU.
CPU hasn't been the limiting hardware in a decade. I think Intel stagnated because people have prioritized spending money on GPUs, memory, and SSDs.
Even when I'm writing an intensive program, I'm using multiple cores, so a single threaded benefit is useless to me.
I have a half a mind to think the m1 is a marketing gimmick because making a better processor was low hanging fruit that CPU companies aren't trying to compete on(outside of price).
maybe poorly worded but i would like to point out that a single-thred performance gain is never useless, not even with a highly a parallel workload.
i would think that due to multi-stage cpu caches and ipc overhead, something within one core/thread will be way more efficient.
GIFs are pretty optimized files — where each "frame" can be a diff from the previous. "De-diffing", converting palette-based pixels to full 24 or 32-bit RGB could really blow up fast.
This is a given for movie formats, but at the time the animated GIF came up it was revolutionary. I think the proper phrase should be "animated GIFs can be pretty optimized, taking into account how inefficient the algorithm is, when compared with other animation algorithms of the time".
I also think there's an interpretation that applies here: When you see an animated gif, even if it's a frame that changes three pixels and nothing else, internally the renderer may be expanding it into a full movie (that is, uncompressing each resulting "frame"). This usually makes GIFs (regardless of how large or small the GIF actually is) take much more memory than common sense would tell you.
1. animation isn't technically intended by the gif format [0]:
> Although GIF was not designed as an animation medium, its ability to store multiple images in one file naturally suggested using the format to store the frames of an animation sequence. To facilitate displaying animations, the GIF89a spec added the Graphic Control Extension (GCE), which allows the images (frames) in the file to be painted with time delays, forming a video clip > > To enable an animation to loop, Netscape in the 1990s used the Application Extension block (intended to allow vendors to add application-specific information to the GIF file) to implement the Netscape Application Block (NAB).........Most browsers now recognize and support NAB, though it is not strictly part of the GIF89a specification
2. SMIL[1] is an animation alternative I'd never heard of for the browser.
[0]: https://en.wikipedia.org/wiki/GIF#Animated_GIF [1]: https://en.wikipedia.org/wiki/Synchronized_Multimedia_Integr...
(Just trying to guess what they meant.)
Memory leaks don't cause swap thrashing most of the time; the leaked memory gets swapped out and then just sits there, as it is unused (hence leaked).
I hope so! My MacBook Air has been running over 10 TB of writes per month. Considerably more than my old Intel MacBook Pro, which averaged 2.8 TB per month. Both 8GB machines.
It's enough that I'm worried it could start to see degraded performance after a couple of years or so. That already seemed to be happening on my Intel MacBook after only ~120 TB writes (256GB SSD).
Until now most laptops sold everywhere, including high end models, where 16GB and below. 32/64 is a tiny niche (and special built to order option in most cases), even for video and music editing people.
Sure, 32GB would be nice, but let's pretend this is some huge issue for but a small minority that runs several VMs simultaneously or such.
Not to mention the M1 machines released thus far (Air, Mini, 13" Pro, and 24" iMac) are the lower end of the line - the kind of machines that people wouldn't tend to update to 32 even when it was an option under Intel (which itself, is not that long ago).
If this actually turns out to be a widespread problem and Apple doesn't address it in a timely update you may see a class-action lawsuit and/or Apple warranty repair service in a few years.
The one which they called a "pig" internally where "lipstick won't fix it", but which they kept selling for years?
That totally broke my trust that Apple will address quality issues.
https://www.ped30.com/2021/03/23/apple-butterfly-lipstick-pi...
I've had one that gave up on 3 years, a couple months after warranty ended (that seemed to be quite common for that brand at the time).
I got the 8GB RAM version, and been mainly using it for Unity + JetBrains Rider, both demanding around 4-6GB by themselves. Doesn't help neither of them are ARM native, I'd imagine. So I'm in big trouble :)
I'm skipping these for now, I run Linux on all my machines and it typically takes a while for the wrinkles to be ironed out, and x86 has much better support than M1. I do think it is time that we became less fixated on x86 and more CPU architectures is better. Another reason for the skip is that the last two Apple products I've owned (both MacBook Airs) have not lived up to expectation, the one had a keyboard that went bad after only two years with nothing but perfectly normal use, the other has a battery that didn't even go through 50 full charge / discharge cycles and that only holds 5 minutes worth of charge. Both of these issues developed out of warranty.
Nah, they suck at it.
My GF is just finishing her bachelors thesis in the living room on my 2013 MBP with 4 GB RAM. First battery, updated all the way from Mavericks to Big Sur. Still supported, still useful and prettier than 80 % machines out there.
It was still going strong after almost a decade of use and got €300 as a trade-in. If that’s Apple‘s idea of planned obsolescence, I support their plan.
If that's their game, they are terrible at it.
Seeing that Macs hold their resale value for longer, for mobile they release iOS updates for longer than any other Android vendor, and so on.
What Apple is good at is making the product an "Apple only can fix/change" affair. But that's not the same as planned obsolescence game.
>With a maximum memory size of 8G it's a bit anemic
Is it? The majority of non-Apple laptops in 2021 are sold at 8G and below. And for people's use (web, surfing, email, Slack, Zoom, regular apps, etc) that the Air and smaller MBPs are aimed at, that has always been plenty.
(In fact, outside of video, audio, 3D, VM, and number crunching work, it's crazy that people would need more than that for the same stuff, computationaly wise, we did 10-15 years ago with much less RAM - blame Electron).
And 16GB and below is something like the 95% percentile or above.
Most other smartphone brands: hold my beer
Edit: Since posting this comment, the parent has been edited to include "hope you got the 16G version" -- at the time I replied, jacquesm's comment mistakenly asserted an absolute "maximum memory size of 8G."
EDIT: It also happens with Firefox Nightly: https://twitter.com/sthomas798/status/1395613674027458567?s=...
Can someone explain to me why people are still using them for that 26 years later, especially now that we have much better formats like webm, mp4, or SVG, and will hopefully have AV1 hardware-supported in a few years ?
The main issue is just how freaking inefficiently huge gifs are for this use case : This whole thread, but also I was seeing an order of magnitude difference in a recent use-case I had, compared to mp4, which would have made sending the document by e-mail otherwise not viable.
(And imagine still living somewhere where a Mo of data doesn't have a negligible cost of transfer...)