MAINT-8689 Diagnostics for coroutine memory crash

master
andreykproductengine 2018-05-14 14:07:36 +03:00
parent f77de22d4d
commit 83dcf6b10d
1 changed files with 8 additions and 1 deletions

View File

@ -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