diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-07-29 11:00:05 +0300 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2024-07-29 21:20:38 +0300 |
commit | c5d2e92089344b115d657eb23487144cb3d9842a (patch) | |
tree | 7b60d24dd3613f92c1d6ce022c080816d9e29aa4 /indra/newview/llmeshrepository.cpp | |
parent | c4ff0b48898de86b9ee8e198395e16a8429c8aa4 (diff) |
viewer#2071 Soft quit on 'out of memory' for meshes #2
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 70 |
1 files changed, 28 insertions, 42 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index a1b2d502af..4c5cc37766 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1360,20 +1360,18 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry) U8* buffer = new(std::nothrow) U8[size]; if (!buffer) { + LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL; + // Not sure what size is reasonable for skin info, // but if 20MB allocation failed, we definetely have issues - const S32 MAX_SIZE = 20 * 1024 * 1024; //20MB + const S32 MAX_SIZE = 30 * 1024 * 1024; //30MB if (size < MAX_SIZE) { - LLError::LLUserWarningMsg::showOutOfMemory(); - LL_ERRS() << "Bad memory allocation for skin info, size: " << size << LL_ENDL; - } - else - { - // Ignore failures for anomalously large data - LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info, size: " << size << LL_ENDL; - } - return false; + LLAppViewer::instance()->outOfMemorySoftQuit(); + } // else ignore failures for anomalously large data + LLMutexLock locker(mMutex); + mSkinUnavailableQ.emplace_back(mesh_id); + return true; } LLMeshRepository::sCacheBytesRead += size; ++LLMeshRepository::sCacheReads; @@ -1485,20 +1483,16 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) U8* buffer = new(std::nothrow) U8[size]; if (!buffer) { + LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; + // Not sure what size is reasonable for decomposition // but if 20MB allocation failed, we definetely have issues - const S32 MAX_SIZE = 20 * 1024 * 1024; //20MB + const S32 MAX_SIZE = 30 * 1024 * 1024; //30MB if (size < MAX_SIZE) { - LLError::LLUserWarningMsg::showOutOfMemory(); - LL_ERRS() << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; - } - else - { - // Ignore failures for anomalously large decompositiions - LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; - } - return false; + LLAppViewer::instance()->outOfMemorySoftQuit(); + } // else ignore failures for anomalously large decompositiions + return true; } LLMeshRepository::sCacheBytesRead += size; ++LLMeshRepository::sCacheReads; @@ -1599,20 +1593,16 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) U8* buffer = new(std::nothrow) U8[size]; if (!buffer) { + LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; + // Not sure what size is reasonable for physcis // but if 20MB allocation failed, we definetely have issues - const S32 MAX_SIZE = 20 * 1024 * 1024; //20MB + const S32 MAX_SIZE = 30 * 1024 * 1024; //30MB if (size < MAX_SIZE) { - LLError::LLUserWarningMsg::showOutOfMemory(); - LL_ERRS() << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; - } - else - { - // Ignore failures for anomalously large meshes - LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition, size: " << size << LL_ENDL; - } - return false; + LLAppViewer::instance()->outOfMemorySoftQuit(); + } // else ignore failures for anomalously large data + return true; } file.read(buffer, size); @@ -1802,22 +1792,18 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, U8* buffer = new(std::nothrow) U8[size]; if (!buffer) { + LL_WARNS(LOG_MESH) << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL; + // Not sure what size is reasonable for a mesh, // but if 20MB allocation failed, we definetely have issues - const S32 MAX_SIZE = 20 * 1024 * 1024; //20MB + const S32 MAX_SIZE = 30 * 1024 * 1024; //30MB if (size < MAX_SIZE) { - LLError::LLUserWarningMsg::showOutOfMemory(); - LL_ERRS() << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL; - } - else - { - // Ignore failures for anomalously large data - LL_WARNS(LOG_MESH) << "Can't allocate memory for mesh " << mesh_id << " LOD " << lod << ", size: " << size << LL_ENDL; - // todo: for now it will result in indefinite constant retries, should result in timeout - // or in retry-count and disabling mesh. (but usually viewer is beyond saving at this point) - } - return false; + LLAppViewer::instance()->outOfMemorySoftQuit(); + } // else ignore failures for anomalously large data + LLMutexLock lock(mMutex); + mUnavailableQ.push_back(LODRequest(mesh_params, lod)); + return true; } LLMeshRepository::sCacheBytesRead += size; ++LLMeshRepository::sCacheReads; |