When I want to new
an object in C++, I need to consider what should I do when there is not enough memory, so I wrote the following code:
CacheHeapItem* m_Items;
try{
m_Items = new CacheHeapItem[m_Count];
}catch(const bad_alloc& e){
DebugBreak();
}
But I am not sure if the DebugBreak
function will be executed when there is insufficient memory?