Open dead-claudia opened 3 years ago
I don't understand the title of this issue. Could you clarify? Thanks.
Something like this:
try {
const foo = new Uint8Array(1*1024*1024*1024)
} catch out of memory somehow {
// display an error or maybe try with a smaller chunk size
}
Stuff like downloading files to decrypt using Web Crypto (which lacks a streaming API and has been dragging their feet for well over a year despite the demand and precedent) and large image/video processing come to mind.
Regarding language precedent, here's a few I found in a few minutes of searching:
malloc
can return a null pointer and you can branch off thatstd::bad_alloc
for general allocations and std::bad_array_new_length
for array allocationsBox::try_new
and friendsMemoryError
NoMemoryError
OutOfMemoryError
This would be valuable for very large allocations where you don't want to crash the application or page, but instead display an error or otherwise tolerate such failure.