)和堆栈分配(stack allocation)的优化,而Hotspot已经在这方面做了很多工作。大多数程序所创建的临时对象都用在单独的线程上下文中,很少被其他线程所用。
基于24个网页-相关网页
堆支持运行时内存分配,和栈不同,大多数语言都允许程序使用堆管理内存。
The heap provides runtime memory allocation, like the stack, meant for data that must outlive the function doing the allocation, unlike the stack. Most languages provide heap management to programs.
就像你知道的那样,值类型是分配在栈上的,而引用类型是分配在GC堆上的。
As you know value types are allocated on the stack unlike reference types which are allocated on the GC heap.
句柄范围只能是在栈上分配的,不能通过new来分配。
Handle scopes can only be stack-allocated, not allocated with new.
So, certainly the CS50 Library designed to be dynamic and, in fact, any time you call get string, we are, in fact, ; allocating a chunk of RAM but it's not coming from the stack; it's actually coming from this portion of memory called the heap.
所以,Cs50库是动态设计的,实际上,每次你调用GetSting时,我们分配一块内存,但它不是来自栈;,而是来自于叫做堆的,内存的一部分。
应用推荐