另一种抛出指针的方法是在建立一个堆对象(new heap object),但这会引发另一个问题:没办法知道异常对象该不该删除。通过指针捕获异常也不符合C++语言本身的规范。
基于18个网页-相关网页
A new object is allocated from the end of this cache without the need to grab the heap lock, so it is very efficient.
新对象是从这个高速缓存的末端分配的,而不必获取堆锁,因此效率非常高。
When CLR allocates a new object, if its size is lower than 85000 bytes, then allocates memory in generation 0; If its size is over 85000 bytes, then allocates memory in large object heap.
CLR分配一个新的对象时,如果其大小小于85000字节,就在第0代中分配,如果其大小大于等于85000自己,就在大对象堆中分配。
The new operator creates the object by allocating the number of bytes required for the specified type from the managed heap.
New算符从受控制的堆里分配指定类型需要的内存来创建对象。
应用推荐