A gif 10 MB consumes 400 MB of RAM or more.

Board for discussions around the Basilisk web browser.

Moderator: Basilisk-Dev

User avatar
arteze
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2020-09-06, 00:18

A gif 10 MB consumes 400 MB of RAM or more.

Unread post by arteze » 2021-11-18, 16:20

It was impossible to see this GIF in Basilisk due to its high use of RAM, in this case the GIF has a size of 9.9 MB. In the browser it causes a use of approximately 400 MB of RAM, or more.

https://github.com/mlajtos/mosaic/raw/m ... -0.0.1.gif

If I download it with and I see it with Viewnior, I can see it, and I see that it consumes 50 MB of RAM.

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by vannilla » 2021-11-18, 16:36

Probably because web browsers are not dedicated media players and have to find compromises, plus the fact that any GIF-encoded image larger that 1MB (and I'm being generous) is always a bad idea.
Get in touch with the person who made the GIF and tell them they are the reason the web is turning to shit more than it was previously.

User avatar
arteze
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2020-09-06, 00:18

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by arteze » 2021-11-18, 18:14

Thanks for the suggestion, I already made the corresponding report to the creator of the GIF file.

While the problem persists, I can block it with uBlock.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35404
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by Moonchild » 2021-11-18, 19:17

Abusing the gif image format for pseudo-video has its drawbacks (primarily that browser will treat it as an image and not as streaming media). the 400MB will be used by storing decoded "frames" in memory as is normal for short animated images, for performance reasons.
All modern browsers support a variety of video formats using the <video> tag -- which are, in fact, often even smaller than videos encoded as gifs!

Also, I'm sure this has been discussed at least a few times on this forum already. Did you even try to search?
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
ron_1
Moon Magic practitioner
Moon Magic practitioner
Posts: 2851
Joined: 2012-06-28, 01:20

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by ron_1 » 2021-11-18, 20:10

Off-topic:
vannilla wrote:
2021-11-18, 16:36
Get in touch with the person who made the GIF and tell them they are the reason the web is turning to shit more than it was previously.
There's nothing like telling it like it is. :)

User avatar
arteze
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2020-09-06, 00:18

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by arteze » 2021-11-18, 21:06

Moonchild wrote:
2021-11-18, 19:17
Abusing the gif image format for pseudo-video has its drawbacks (primarily that browser will treat it as an image and not as streaming media). the 400MB will be used by storing decoded "frames" in memory as is normal for short animated images, for performance reasons.
All modern browsers support a variety of video formats using the <video> tag -- which are, in fact, often even smaller than videos encoded as gifs!

Also, I'm sure this has been discussed at least a few times on this forum already. Did you even try to search?
Yes, I searched, but I did not find much, for example, I found the next topic, that talks about the CPU it uses when it closes a tab with gifs, but not on the RAM using the gif... As I am reading, that was not a browser problem, is that the user entered a community of criptominers.

viewtopic.php?f=61&t=19229

A possible implementation that occurs to me mentally, is as each frame is decoded, that there is an array by pixel, and the number of paintings that are equal.

Pixel 0,0 -> (#0f0,10)(#f00,5), means that (x: 0, y: 0) is equal for 10 frames green, and 5 frames red... I do not know if this would save RAM.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35404
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by Moonchild » 2021-11-18, 22:37

arteze wrote:
2021-11-18, 21:06
Yes, I searched, but I did not find much
lrn2srch
search.php?keywords=memory+large+gif
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
arteze
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2020-09-06, 00:18

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by arteze » 2021-11-19, 01:42

Well, I had searched for Basilisk, not Palemoon, that's why I had not found many results.

Another problem is that I have to close the tab before you fill out all the memory, so I avoid the browser freezing if I arrive on time... In case of being able to close the tab, continue occupying memory, then to vacate it, the only solution is to restart the browser.
Screenshot(184).PNG
Screenshot(184).PNG (3.77 KiB) Viewed 1462 times
I installed the extension to pause the gifs, Toggle animated GIFs, It serves that when loading the page, those gifs, do not move, but that does not prevent 400 MB from loading in the RAM for the gifs 10 MB.

I think that programmatically, each box could be kept in memory, but compressed, will this affect the performance a lot? If the RAM read faster than a hard drive, I think not much.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by moonbat » 2021-11-19, 02:24

What makes more sense - asking websites to not abuse the GIF format, or further enabling such behavior by changing browser code?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

New Tobin Paradigm

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by New Tobin Paradigm » 2021-11-19, 02:29

The gif format needs to just die off..

User avatar
arteze
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2020-09-06, 00:18

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by arteze » 2021-11-19, 02:44

moonbat wrote:
2021-11-19, 02:24
What makes more sense - asking websites to not abuse the GIF format, or further enabling such behavior by changing browser code?
The problem is that it is a GitHub Markdown (readme.md file), I do not know if it is allowed to insert embedded videos in that format, perhaps accept webm / webp.

I saw that JustOff published this link that shows that in Firefox this was solved in 2018 (4 years ago).

viewtopic.php?f=5&t=24497&hilit=gifs#p190978

https://bugzilla.mozilla.org/show_bug.cgi?id=523950

So, does that serve as a guide to solve it in Basilisk?

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by moonbat » 2021-11-19, 03:03

Did you even read the rest of that thread?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
arteze
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2020-09-06, 00:18

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by arteze » 2021-11-19, 03:19

moonbat wrote:
2021-11-19, 03:03
Did you even read the rest of that thread?
Yes, I read it, I see that they propose a Zip Bomb, but there was the thread end and that possibility was not debated.

Code: Select all

I mean, an option to prevent excessive memory usage. It looks like zip-bomb for me...
I think that it can be easy to implement and could reduce memory.

Another thing that I would like is that the browser detects when it is about to run out of memory, in that case, to dispense memory and stops the gif load. In this way the operating system would continue to work and I do not have to restart the computer.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by moonbat » 2021-11-19, 03:40

You completely blew over Moonchild's detailed reply and just jumped to the end didn't you?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
arteze
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2020-09-06, 00:18

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by arteze » 2021-11-19, 04:21

I read the answer, I understand that it is being abusing the gif as video, but also by that abuse crash the browser, and I think it's a good idea to prevent the load, in uBlock you have to choose that option for each site, I do not see how to block them at all.

Being Github, I understand that you have to suggest the author of the gif that changes it, but perhaps with another gif that is not possible. For this reason the Basilisk browser unusable the operating system unusable until the computer is closed or restarted.

The problem exists in Basilisk, the browser has chosen it for its small memory usage compared to Firefox, but other browsers, with fewer features, such as the author's browser, of the gif, Mosaic, has the problem solved, I do not know the exact cause , it can be because it uses another rendering engine, I do not know.

Maybe in 2020 it seemed a complicated task to solve it, but maybe now it is not so much, now there are more ideas like the ones I am describing. What I do not know is, if the opinion changed about it.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35404
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by Moonchild » 2021-11-19, 11:46

If your OS becomes sluggish/unresponsive because 400 MB is too much memory usage and you start swapping then maybe you should consider using a normal amount of RAM in your PC for 2020 instead of asking that we go out of our way for a corner case of abuse of an image format. Also, there are some proposed workarounds in the other threads if you'd care to actually try them instead of going on here.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by vannilla » 2021-11-19, 12:48

Apparently that guy responded, saying that WebM is not universally supported. Considering that GitHub can barely be usable by browsers not supporting WebM, I wonder what exactly he's trying to target.
Also, he said that GIF autoloops unlinke videos and he would be correct... if his showcase had any reason to autoloop. It's not a real animation but a showcase: you don't need it to loop, but you need it to provide a high quality encoding so that viewers can see with as much details and the he least annoyance as possible, what you are trying to showcase.
It's fine to let people start the video when they want to, especially when they don't have to download the actual data until "play" is pressed. They can also go back in time if they missed something instead of waiting for the loop to restart, not to mention you can fit more time in less data.
GIF is the worst possible format for a showcase, "thank you for a good chuckle" indeed.

User avatar
arteze
Apollo supporter
Apollo supporter
Posts: 32
Joined: 2020-09-06, 00:18

Re: A gif 10 MB consumes 400 MB of RAM or more.

Unread post by arteze » 2021-11-19, 16:31

Moonchild wrote:
2021-11-19, 11:46
If your OS becomes sluggish/unresponsive because 400 MB is too much memory usage and you start swapping then maybe you should consider using a normal amount of RAM in your PC for 2020 instead of asking that we go out of our way for a corner case of abuse of an image format. Also, there are some proposed workarounds in the other threads if you'd care to actually try them instead of going on here.
There are two ways, one is having a better computer, at the moment it is the only one I have, I can not buy another better, the other is not visiting the site, but that is not the only place with big gif, the internet is full of images like this.

The next parameter apparently does not stop memory consumption, only shows the detained image after loading it completely.

Code: Select all

about:config > image.animation_mode = none
Another idea that I have, is that there must be an extension that transforms the gif into the video, and then shows it as video, for this, first it is necessary to stop the gif load and get the link to convert it.

At least, I would like the browser to make a necessary calculation of the required memory before showing the gif, if it exceeds free memory, then it should not show it.
vannilla wrote:
2021-11-19, 12:48
Apparently that guy responded
I forgot to insert the link of the problem reported in Github, I leave it in case someone else wants to see it.

https://github.com/mlajtos/mosaic/issues/49

What the author of the gif answered me, among other things, was the following:.. As preferably, if you want to see more repository things, have uBlock enabled, with the option, "Click to block large media elements on this site" if Basilisk is used and enough memory is available... Fortunately on the subject, there is no gif, so you can see the discussion correctly.
One time I got a request to change embedded video from MP4 to something else because the user didn't have codecs for MP4 on his system.
Then, in my case the problem is with the gif, but there are also people who have problems with the mp4... If the owner wants to change it to mp4, I would have to choose an adequate codec, since that format accepts different variants of codecs.

I mean, Github is not a strange page to which no one visits, is very visited, it may be that just that repository is not very visited, and that maybe I am not the only one who has such an old computer that visits pages with large gifs.

Locked