From 83dcf6b10daff1ec886063a968c884cdc79c47ed Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 14 May 2018 14:07:36 +0300 Subject: MAINT-8689 Diagnostics for coroutine memory crash --- indra/llcommon/llcoros.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 4bab669046..3165ce0743 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -283,6 +283,7 @@ void LLCoros::setStackSize(S32 stacksize) void LLCoros::printActiveCoroutines() { + LL_INFOS("LLCoros") << "Number of active coroutines: " << (S32)mCoros.size() << LL_ENDL; LL_INFOS("LLCoros") << "-------------- List of active coroutines ------------"; CoroMap::iterator iter; CoroMap::iterator end = mCoros.end(); @@ -401,7 +402,13 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl std::string name(generateDistinctName(prefix)); Current current; // pass the current value of Current as previous context - CoroData* newCoro = new CoroData(current, name, callable, mStackSize); + CoroData* newCoro = new(std::nothrow) CoroData(current, name, callable, mStackSize); + if (newCoro == NULL) + { + // Out of memory? + printActiveCoroutines(); + LL_ERRS("LLCoros") << "Failed to start coroutine: " << name << " Stacksize: " << mStackSize << " Total coroutines: " << mCoros.size() << LL_ENDL; + } // Store it in our pointer map mCoros.insert(name, newCoro); // also set it as current -- cgit v1.2.3