#3627 Warn user about low memory on bad_alloc
parent
f40c5b209b
commit
ecac92c60c
|
|
@ -301,12 +301,12 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
|
|||
mPoolSize(size),
|
||||
mActiveCoprocsCount(0),
|
||||
mPending(0),
|
||||
mPendingCoprocs(std::make_shared<CoprocQueue_t>(LLCoprocedureManager::DEFAULT_QUEUE_SIZE)),
|
||||
mHTTPPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
|
||||
mCoroMapping()
|
||||
{
|
||||
try
|
||||
{
|
||||
mPendingCoprocs = std::make_shared<CoprocQueue_t>(LLCoprocedureManager::DEFAULT_QUEUE_SIZE);
|
||||
// store in our LLTempBoundListener so that when the LLCoprocedurePool is
|
||||
// destroyed, we implicitly disconnect from this LLEventPump
|
||||
// Monitores application status
|
||||
|
|
@ -339,6 +339,11 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
|
|||
|
||||
llassert(0); // Fix Me! Ignoring missing listener!
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
LLError::LLUserWarningMsg::showOutOfMemory();
|
||||
LL_ERRS("CoProcMgr") << "Bad memory allocation in LLCoprocedurePool::LLCoprocedurePool!" << LL_ENDL;
|
||||
}
|
||||
|
||||
for (size_t count = 0; count < mPoolSize; ++count)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -295,7 +295,15 @@ void HttpCoroHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons
|
|||
}
|
||||
else
|
||||
{
|
||||
result = this->handleSuccess(response, status);
|
||||
try
|
||||
{
|
||||
result = this->handleSuccess(response, status);
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
LLError::LLUserWarningMsg::showOutOfMemory();
|
||||
LL_ERRS("CoreHTTP") << "Failed to allocate memory for response handling." << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
buildStatusEntry(response, status, result);
|
||||
|
|
|
|||
|
|
@ -100,8 +100,16 @@ LLSkyTex::LLSkyTex() :
|
|||
void LLSkyTex::init(bool isShiny)
|
||||
{
|
||||
mIsShiny = isShiny;
|
||||
mSkyData = new LLColor4[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)];
|
||||
mSkyDirs = new LLVector3[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)];
|
||||
try
|
||||
{
|
||||
mSkyData = new LLColor4[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)];
|
||||
mSkyDirs = new LLVector3[(U32)(SKYTEX_RESOLUTION * SKYTEX_RESOLUTION)];
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
LLError::LLUserWarningMsg::showOutOfMemory();
|
||||
LL_ERRS() << "Failed to allocate memory for sky texture data" << LL_ENDL;
|
||||
}
|
||||
|
||||
for (S32 i = 0; i < 2; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1412,7 +1412,18 @@ void LLPipeline::createLUTBuffers()
|
|||
{
|
||||
U32 lightResX = gSavedSettings.getU32("RenderSpecularResX");
|
||||
U32 lightResY = gSavedSettings.getU32("RenderSpecularResY");
|
||||
F32* ls = new F32[lightResX*lightResY];
|
||||
F32* ls = nullptr;
|
||||
try
|
||||
{
|
||||
ls = new F32[lightResX*lightResY];
|
||||
}
|
||||
catch (std::bad_alloc&)
|
||||
{
|
||||
LLError::LLUserWarningMsg::showOutOfMemory();
|
||||
// might be better to set the error into mFatalMessage and rethrow
|
||||
LL_ERRS() << "Bad memory allocation in createLUTBuffers! lightResX: "
|
||||
<< lightResX << " lightResY: " << lightResY << LL_ENDL;
|
||||
}
|
||||
F32 specExp = gSavedSettings.getF32("RenderSpecularExponent");
|
||||
// Calculate the (normalized) blinn-phong specular lookup texture. (with a few tweaks)
|
||||
for (U32 y = 0; y < lightResY; ++y)
|
||||
|
|
|
|||
Loading…
Reference in New Issue