зеркало из https://github.com/mozilla/gecko-dev.git
Bug 772643: Don't allocate memory in hang monitor while a thread is suspended. r=ehsan
This commit is contained in:
Родитель
4d5317709a
Коммит
1788b77043
|
@ -58,6 +58,9 @@ static HANDLE winMainThreadHandle = NULL;
|
|||
|
||||
// Default timeout for reporting chrome hangs to Telemetry (5 seconds)
|
||||
static const PRInt32 DEFAULT_CHROME_HANG_INTERVAL = 5;
|
||||
|
||||
// Maximum number of PCs to gather from the stack
|
||||
static const PRInt32 MAX_CALL_STACK_PCS = 400;
|
||||
#endif
|
||||
|
||||
// PrefChangedFunc
|
||||
|
@ -111,7 +114,9 @@ ChromeStackWalker(void *aPC, void *aSP, void *aClosure)
|
|||
MOZ_ASSERT(aClosure);
|
||||
Telemetry::HangStack *callStack =
|
||||
reinterpret_cast< Telemetry::HangStack* >(aClosure);
|
||||
callStack->AppendElement(reinterpret_cast<uintptr_t>(aPC));
|
||||
|
||||
if (callStack->Length() < MAX_CALL_STACK_PCS)
|
||||
callStack->AppendElement(reinterpret_cast<uintptr_t>(aPC));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -119,6 +124,10 @@ GetChromeHangReport(Telemetry::HangStack &callStack, SharedLibraryInfo &moduleMa
|
|||
{
|
||||
MOZ_ASSERT(winMainThreadHandle);
|
||||
|
||||
// The thread we're about to suspend might have the alloc lock
|
||||
// so allocate ahead of time
|
||||
callStack.SetCapacity(MAX_CALL_STACK_PCS);
|
||||
|
||||
DWORD ret = ::SuspendThread(winMainThreadHandle);
|
||||
if (ret == -1) {
|
||||
callStack.Clear();
|
||||
|
|
Загрузка…
Ссылка в новой задаче