Do ArrayBuffers have a maximum length?

前端 未结 4 1064
失恋的感觉
失恋的感觉 2020-12-11 18:14

I little confused here. Do ArrayBuffer allocate a new memory region for it? If so, what would be the safe maximum Blob size to put on it?

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-11 19:05

    I was also asking myself the same question. It seems that buffer is limited by available system memory and the ability of underlying JavaScript engine's GC to handle large amounts of memory. You can easily test it for your platform by creating large buffers in your browser's console and on the other side monitoring browser's process and overall memory footprint.

    I just managed to create buffers larger than 512MB on Chrome 37. However I have 4GB of system memory so it could obviously lead to crash after more allocation. I'm not interested in finding breaking point since I'm fine with allocations up to 100MB, but you can obviously test it easily for yourself.

提交回复
热议问题