When allocator fails because of limited memory. The app is crashing. throwing bad_alloc or return nullptr doesn't stop crash. Anyone have any idea?
pointer allocator<T>(size_type count) const
{
void* buffer = new (count * sizeof(T));
if (!buffer) // if buffer == nullptr crashes app
throw bad_alloc; // doing this crashes app
}
So what to do to gracefully close the app and say not enough memory?
Aucun commentaire:
Enregistrer un commentaire