コード例 #1
0
void DictionaryStats::ClearStats()
{
    // Clear the collection since we already reported on what we already collected
    DictionaryType* current = dictionaryTypes;
    while(current)
    {
        DictionaryType *type = current;
        DictionaryStats *pNext = type->instances;
        while(pNext)
        {
            DictionaryStats *pCurrent = pNext;
            pNext = pNext->pNext;
            NoCheckHeapDelete(pCurrent);
        }
        current = current->pNext;
        NoCheckHeapDelete(type);
    }
    dictionaryTypes = NULL;
}
コード例 #2
0
MemoryProfiler::~MemoryProfiler()
{
#if DBG
    pageAllocator.SetDisableThreadAccessCheck();
#endif
    if (next != nullptr)
    {
        NoCheckHeapDelete(next);
    }
}
コード例 #3
0
ファイル: LeakReport.cpp プロジェクト: liminzhu/ChakraCore
void
LeakReport::DumpUrl(DWORD tid)
{
    AutoCriticalSection autocs(&s_cs);
    if (!EnsureLeakReportFile())
    {
        return;
    }

    UrlRecord * prev = nullptr;
    UrlRecord ** pprev = &LeakReport::urlRecordHead;
    UrlRecord * curr = *pprev;
    while (curr != nullptr)
    {
        if (curr->tid == tid)
        {
            char16 timeStr[26] = _u("00:00");

            // xplat-todo: Need to implement _wasctime_s in the PAL
#if _MSC_VER
            struct tm local_time;
            _localtime64_s(&local_time, &curr->time);
            _wasctime_s(timeStr, &local_time);
#endif
            timeStr[wcslen(timeStr) - 1] = 0;
            Print(_u("%s - (%p, %p) %s\n"), timeStr, curr->scriptEngine, curr->globalObject, curr->url);
            *pprev = curr->next;
            NoCheckHeapDeleteArray(wcslen(curr->url) + 1, curr->url);
            NoCheckHeapDelete(curr);
        }
        else
        {
            pprev = &curr->next;
            prev = curr;
        }
        curr = *pprev;
    }

    if (prev == nullptr)
    {
        LeakReport::urlRecordTail = nullptr;
    }
    else if (prev->next == nullptr)
    {
        LeakReport::urlRecordTail = prev;
    }
}