在 Chrome 上使用 RESULT_CODE_KILLED_BAD_MESSAGE 构建大型 JS Blob 崩溃选项卡
Constructing Large JS Blob Crashes Tab with RESULT_CODE_KILLED_BAD_MESSAGE on Chrome
我正在从大量较小的 blob 客户端构建一个大型(多 gb)Blob,以上传到 Firebase 存储。但是,当我在数组上调用 blob 构造函数时,Chrome 选项卡会冻结一会儿然后崩溃。当 Blob 较小(数百 mb)时它工作正常 Chrome 文档建议我不应该让大 blob 变快:
Creating Large Blobs Too Fast
Creating a lot of blobs, especially if they are very large blobs, can cause the renderer memory to grow too fast and result in an OOM on the renderer side. This is because the renderer temporarily stores the blob data while it waits for the browser to request it. Meanwhile, Javascript can continue executing. Transfering the data can take a lot of time if the blob is large enough to save it directly to a file, as this means we need to wait for disk operations before the renderer can get rid of the data.
如何更“缓慢地”创建它以便将其分页到磁盘?
我意识到问题不是我提供给 Blob 构造函数的数组中 blob 的大小,而是 array 的大小。有数百万个小斑点。我更改了制作数组的 MediaRecorder 的 timeSlice,因此它每 10 秒制作一次大斑点,而不是每 10 毫秒制作一次小斑点,然后修复了它。
我正在从大量较小的 blob 客户端构建一个大型(多 gb)Blob,以上传到 Firebase 存储。但是,当我在数组上调用 blob 构造函数时,Chrome 选项卡会冻结一会儿然后崩溃。当 Blob 较小(数百 mb)时它工作正常 Chrome 文档建议我不应该让大 blob 变快:
Creating Large Blobs Too Fast
Creating a lot of blobs, especially if they are very large blobs, can cause the renderer memory to grow too fast and result in an OOM on the renderer side. This is because the renderer temporarily stores the blob data while it waits for the browser to request it. Meanwhile, Javascript can continue executing. Transfering the data can take a lot of time if the blob is large enough to save it directly to a file, as this means we need to wait for disk operations before the renderer can get rid of the data.
如何更“缓慢地”创建它以便将其分页到磁盘?
我意识到问题不是我提供给 Blob 构造函数的数组中 blob 的大小,而是 array 的大小。有数百万个小斑点。我更改了制作数组的 MediaRecorder 的 timeSlice,因此它每 10 秒制作一次大斑点,而不是每 10 毫秒制作一次小斑点,然后修复了它。