我知道crypto.subtle.digest可用于生成给定 ArrayBuffer 的摘要。
但是,当文件很大时,例如 5GB,我总是收到此错误
Uncaught (in promise) DOMException: 无法读取请求的文件,通常是由于在获取对文件的引用后发生的权限问题。
点击https://jsfiddle.net/kq4s2utf/查看完整版本。
我该如何解决这个问题?
我试图弄清楚什么时候为我的程序分配了内存。这是我的代码
#include <unistd.h>
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
cout << "when the memory is allocated?";
cout << endl;
cout.flush();
int * p = new int[250000000];
sleep(3);
cout << "address: " << p;
cout << endl;
cout.flush();
sleep(3);
cout << "value" << p[0];
cout << endl;
cout.flush();
sleep(10);
cout << "ending";
cout << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我用 mac 上的活动监视器跟踪它。
我发现我没有得到我申请的 GB 内存。什么时候new int[250000000]在 C++ 中实际分配内存?