virtualpointer=(char*) VirtualAlloc (NULL, (unsigned __int64) (1<<31), MEM_RESERVE, PAGE_READWRITE);mainhashbuf=progression=virtualpointer;VirtualAlloc (progression, (unsigned __int64) (1<<15), MEM_COMMIT, PAGE_READWRITE);progression=progression+capacity;*(mainhashbuf+1000)='c';mainhashbuf,progress和virtualpointer是指向char的指针。我首先保留空间,虚拟指针指向该空间。然后我将其他2个指针设置为等于虚拟指针。然后,我使用渐进式提交(1 最佳答案 VirtualAlloc尝试分配连续范围的虚拟页面。 1 选择较低的值,然后重新开始。另外,为什么要使用VirtualAlloc?当您不熟悉指针和直接内存管理时,以页面大小的单元进行提交和保留的概念可能有些令人生畏。尝试先使用malloc / HeapAlloc吗?另外,检查VirtualAlloc的返回值,并确保它们不是非NULL。关于c++ - virtualalloc问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5892199/
10-10 13:41