3 ms·
I wonder why it's an issue to allocate 2GB of zeros anyway. With virtual memory, it should all map to the same zeroed page until they get written. And With tran
by ant6n 11y ago
I wonder why it's an issue to allocate 2GB of zeros anyway. With virtual memory, it should all map to the same zeroed page until they get written. And With transparent huge page support, it should only allocate few such pages until they get written.
- Hydraulix989 11y agoWhen I was testing last summer, users' browsers would crash while allocating even 512 MB for the emscripten heap.
- DiThi 11y agoBecause many browsers are still 32 bit even in 64 bit systems. That means they get 2GB of virtual space in total. And frequently they don't have 256 MB of aligned and continuous virtual memory (and I suffered the pain of trying to develop a web application that uses 128 MB for months, in the end we ditched the C++ part).
- ant6n 11y agoThat's fair, I guess. Although I thought browsers like chrome run every window in a different process, thus each has their own virtual memory. I guess the browsers should specialize on very large typed arrays, because with asm.js etc they will most likely be very sparse (e.g. allocate 2gb of zeros, use 50mb).