Merge pull request #4624 from ctrlaltdavid/memory-fixes

Replace try with nothrow
This commit is contained in:
Brad Davis 2015-04-09 12:30:44 -07:00
commit 3d6cf82659

View file

@ -27,9 +27,9 @@ Resource::Size Resource::Sysmem::allocateMemory(Byte** dataAllocated, Size size)
if (size > 0) {
// Try allocating as much as the required size + one block of memory
newSize = size;
try {
(*dataAllocated) = new Byte[newSize];
} catch (const std::bad_alloc&) {
(*dataAllocated) = new (std::nothrow) Byte[newSize];
// Failed?
if (!(*dataAllocated)) {
qWarning() << "Buffer::Sysmem::allocate() : Can't allocate a system memory buffer of " << newSize << "bytes. Fails to create the buffer Sysmem.";
return NOT_ALLOCATED;
}