WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 272232
268816
iPad with 8 GB of RAM offers only 1.88 GB of RAM to a website via UInt8Array
https://bugs.webkit.org/show_bug.cgi?id=268816
Summary
iPad with 8 GB of RAM offers only 1.88 GB of RAM to a website via UInt8Array
Ivan Kuckir
Reported
2024-02-06 03:19:40 PST
I have made a web-based photo editor www.Photopea.com, which is used by hundreds of thousands of people on iOS devices. My user has reported, that Safari often kills Photopea because of lack of RAM. I have made this test:
https://jsfiddle.net/98tr67qb/
. iPad Pro M1 (8 GB of RAM) offers a website only 1.88 GB of RAM (no other apps are running). My Android phone has 6 GB of RAM and Chrome is ready to give 5.25 GB of RAM to a website. Do you plan to offer more RAM to websites? Advanced image manipulation requires storing hundreds of millions of pixels in RAM.
Attachments
Add attachment
proposed patch, testcase, etc.
Ivan Kuckir
Comment 1
2024-02-06 03:29:51 PST
"FUN FACT": my Macbook Air with 8 GB of RAM gets 30 GB of RAM in the test (probably because you do paging to the hard drive). So two devices with the same amount of RAM, from the same company, running the same browser. One gets 16x more RAM than the other.
Alexey Proskuryakov
Comment 2
2024-02-06 10:53:14 PST
Thank you for the report! This is not controlled by code in WebKit. I encourage you to file a report via
https://feedbackassistant.apple.com
, so that Apple engineers responsible for this would take a look.
Ivan Kuckir
Comment 3
2024-02-06 11:34:36 PST
Do you own an iPad? I think every iPad owner should report it to Apple, because it this behaviour of Safari is actually pretty crazy. So could you get in touch with people responsible for this, as you are an employee of Apple and you probably have more chances to change something, rather than me, as I am just one of billions of your clients?
Alexey Proskuryakov
Comment 4
2024-02-06 14:31:42 PST
I recommend filing your own feedback with specific use cases (like you did here).
Ivan Kuckir
Comment 5
2024-02-27 01:12:50 PST
I did, there is still no response. Do you limit web apps to 2 GB of RAM to make sure they have no chance to replace apps distributed through your app market?
Alexey Proskuryakov
Comment 6
2024-02-27 08:52:23 PST
If you post your feedback ID here, I can check if it got to the right people quickly.
Ivan Kuckir
Comment 7
2024-02-27 09:13:25 PST
The ID is FB13590874.
Alexey Proskuryakov
Comment 8
2024-03-06 15:19:09 PST
rdar://122408476
Thank you! On a second thought, I think that it's correct to track this as a JavaScriptCore issue. We are not getting jetsammed here, it's just that the allocator for arrays doesn't five more memory that that.
Ivan Kuckir
Comment 9
2024-03-06 23:30:34 PST
I dont think it is related to your array allocator. Is there a way to allocate 3 GB of space in Javascript without using Arrays?
Ben Nham
Comment 10
2024-03-13 10:15:30 PDT
There are different memory limits in play for web content on iOS. 1. Webpages are loaded into a WebContent process. This process has an OS-defined memory limit. On iPhones, for most devices, the limit is 1.5GB (although if the system is not under memory pressure, the process may be able to exceed this limit). On iPad, the WebContent process has a higher memory limit, which differs by device. For an 8GB device, the limit will be in the 4GB+ range. I find it unlikely that these limits will change anytime soon, as they are chosen for user experience reasons (e.g. preventing a rogue webpage from causing all your background apps or background webpages from being killed on your phone). 2. Typed arrays, along with some other types of memory (like wasm memory) are allocated into a region called the Gigacage for security reasons. Currently the Gigacage supports 2GB of allocations on iOS. This has been the case for several years and we will probably not change this imminently, but we could possibly look into adjusting this if there are enough use cases that are running into this particular limit. (Incidentally, it is not as easy as just "increasing a limit" due to VA space layout reasons, but that's another discussion.) So in the given example, your webpage is primarily allocating TypedArrays, which will be limited to ~2GB due to the gigacage restriction on iPads. On iPhones, you will likely be out-of-memory killed earlier by the OS at ~1.5GB of allocations. The Gigacage limit will almost never come in to play. If you have some concrete examples of images in your editor that trigger the Gigacage limit described in (2), that would really help the JavaScriptCore team with evaluating how that limit should evolve in the future. But keep in mind that changing that particular limit will have no effect on the OS-level memory killer described in (1).
Ben Nham
Comment 11
2024-03-13 10:27:48 PDT
Actually, we are already having a discussion on gigacage implementation/limits/evolution in this bug:
https://bugs.webkit.org/show_bug.cgi?id=269937
If you can reply there with some concrete examples of where you're running into this limit in your editor with some images, that would be useful as part of that discussion. I'm going to dup this bug there. *** This bug has been marked as a duplicate of
bug 269937
***
Ivan Kuckir
Comment 12
2024-03-13 15:55:44 PDT
To see the problem, open this PSD document:
https://www.photopea.com/templates/t-853Y7zGo
. Then, click Image - Image Size - Enter the Width of 3000 pixels, and click OK. This works fine on my Android phone, but crashes on my iPad.
Jesal Vein
Comment 13
2024-05-15 01:57:51 PDT
(In reply to Ben Nham from
comment #11
)
> Actually, we are already having a discussion on gigacage > implementation/limits/evolution in this bug: >
https://bugs.webkit.org/show_bug.cgi?id=269937
https://monopolygo.io
> > If you can reply there with some concrete examples of where you're running > into this limit in your editor with some images, that would be useful as > part of that discussion. I'm going to dup this bug there. > > *** This bug has been marked as a duplicate of
bug 269937
***
How does the operating system-defined memory limit for the WebContent process vary between iPhones and iPads, and what factors influence the flexibility of these limits?
Alexey Proskuryakov
Comment 14
2024-05-15 13:31:19 PDT
I do not think that this is documented by Apple.
Ben Nham
Comment 15
2024-05-15 13:45:00 PDT
As for the topic of this bug, I believe that the issue where UInt8Array is constrained by JavaScriptCore to only ~2GB of usage is fixed by
277124@main
, which increases the size of the gigacage on iOS. As a result I'm changing the dup to 272232. I can't say for sure though since loading
https://www.photopea.com/templates/t-853Y7zGo
does not seem to load an image in any browser that I tried. *** This bug has been marked as a duplicate of
bug 272232
***
Ivan Kuckir
Comment 16
2024-06-21 09:48:38 PDT
Please, try this demo to see how much RAM a website is able to get:
https://jsfiddle.net/98tr67qb/
On a device with 8 GB of RAM, a website should be able to get at least 6-7 GB of RAM, as long as there is that much free RAM. iPad with 8 GB of RAM allows having only 1.88 GB.
Alexey Proskuryakov
Comment 17
2024-06-21 10:56:14 PDT
What are you getting with iPadOS 18 beta? I don't have an appropriate device handy.
peachyday23
Comment 18
2024-06-30 12:13:39 PDT
i have this problem how can i report it to apple? also mine says it needs 0 mb of ram when i get the error sometimes and other it says i need 5-10 MB which are less then gb and my storage it isn’t even close to being all taken up i’m very confused
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug