简体   繁体   English

堆分配对于大块的分页是否更有效?

[英]Is heap allocation more efficient for paging in large blocks?

For large (~64k+) allocations, is heap allocation more efficient?对于大型(~64k+)分配,堆分配是否更有效?

For stack allocation, the pages need to be demand-paged in when used.对于堆栈分配,页面在使用时需要按需调入。 Do allocators typically do this more efficiently for the heap, for instance mapping virtual memory pages to physical memory in bulk?分配器是否通常为堆更有效地执行此操作,例如将虚拟 memory 页面批量映射到物理 memory?

As I know always stack is more efficient.据我所知,堆栈总是更有效。 But the stack is static, but heap will grow dynamically.但是栈是static,但是堆会动态增长。 So it is better to use the heap for the large memory usage to prevent stack overflow所以对于大的memory使用最好使用堆来防止堆栈溢出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM