• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ VisualLeakDetector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VisualLeakDetector的典型用法代码示例。如果您正苦于以下问题:C++ VisualLeakDetector类的具体用法?C++ VisualLeakDetector怎么用?C++ VisualLeakDetector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VisualLeakDetector类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Create

CallStack* CallStack::Create()
{
    CallStack* result = NULL;
    if (g_vld.GetOptions() & VLD_OPT_SAFE_STACK_WALK) {
        result = new SafeCallStack();
    }
    else {
        result = new FastCallStack();
    }
    return result;
}
开发者ID:viknash,项目名称:vld,代码行数:11,代码来源:callstack.cpp


示例2: VLDReportLeaks

__declspec(dllexport) UINT VLDReportLeaks ()
{
    return (UINT)g_vld.ReportLeaks();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例3: VLDGlobalEnable

__declspec(dllexport) void VLDGlobalEnable ()
{
    g_vld.GlobalEnableLeakDetection();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例4: VLDRestore

__declspec(dllexport) void VLDRestore ()
{
    g_vld.RestoreLeakDetectionState();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例5: VLDDisable

__declspec(dllexport) void VLDDisable ()
{
    g_vld.DisableLeakDetection();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例6: VLDGetThreadLeaksCount

__declspec(dllexport) UINT VLDGetThreadLeaksCount (UINT threadId)
{
    return (UINT)g_vld.GetThreadLeaksCount(threadId);
}
开发者ID:HanLuo,项目名称:pskynet,代码行数:4,代码来源:vldapi.cpp


示例7: VLDGetOptions

__declspec(dllexport) UINT VLDGetOptions()
{
    return g_vld.GetOptions();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例8: VLDRefreshModules

__declspec(dllexport) void VLDRefreshModules()
{
    g_vld.RefreshModules();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例9: VLDSetModulesList

__declspec(dllexport) void VLDSetModulesList(CONST WCHAR *modules, BOOL includeModules)
{
    g_vld.SetModulesList(modules, includeModules);
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例10: VLDSetReportHook

__declspec(dllexport) int VLDSetReportHook(int mode,  VLD_REPORT_HOOK pfnNewHook)
{
    return g_vld.SetReportHook(mode, pfnNewHook);
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例11: VLDSetOptions

__declspec(dllexport) void VLDSetOptions(UINT option_mask, SIZE_T maxDataDump, UINT maxTraceFrames)
{
    g_vld.SetOptions(option_mask, maxDataDump, maxTraceFrames);
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例12: resolve

// Resolve - Creates a nicely formatted rendition of the CallStack, including
//   symbolic information (function names and line numbers) if available. and
//   saves it for later retrieval. This is almost identical to Callstack::dump above.
//
//   Note: The symbol handler must be initialized prior to calling this
//     function.
//
//  - showInternalFrames (IN): If true, then all frames in the CallStack will be
//      dumped. Otherwise, frames internal to the heap will not be dumped.
//
//  Return Value:
//
//    None.
//
int CallStack::resolve(BOOL showInternalFrames)
{
    if (m_resolved)
    {
        // already resolved, no need to do it again
        // resolving twice may report an incorrect module for the stack frames
        // if the memory was leaked in a dynamic library that was already unloaded.
        return 0;
    }

    if (m_status & CALLSTACK_STATUS_STARTUPCRT) {
        // there is no need to resolve a leak that will not be reported
        return 0;
    }

    if (m_status & CALLSTACK_STATUS_INCOMPLETE) {
        // This call stack appears to be incomplete. Using StackWalk64 may be
        // more reliable.
        Report(L"    HINT: The following call stack may be incomplete. Setting \"StackWalkMethod\"\n"
            L"      in the vld.ini file to \"safe\" instead of \"fast\" may result in a more\n"
            L"      complete stack trace.\n");
    }

    int unresolvedFunctionsCount = 0;
    IMAGEHLP_LINE64  sourceInfo = { 0 };
    sourceInfo.SizeOfStruct = sizeof(IMAGEHLP_LINE64);

    bool skipStartupLeaks = !!(g_vld.GetOptions() & VLD_OPT_SKIP_CRTSTARTUP_LEAKS);

    // Use static here to increase performance, and avoid heap allocs.
    // It's thread safe because of g_heapMapLock lock.
    static WCHAR stack_line[MAXREPORTLENGTH + 1] = L"";
    bool isPrevFrameInternal = false;
    bool isDynamicInitializer = false;
    DWORD NumChars = 0;
    CriticalSectionLocker<DbgHelp> locker(g_DbgHelp);

    const size_t max_line_length = MAXREPORTLENGTH + 1;
    m_resolvedCapacity = m_size * max_line_length;
    const size_t allocedBytes = m_resolvedCapacity * sizeof(WCHAR);
    m_resolved = new WCHAR[m_resolvedCapacity];
    if (m_resolved) {
        ZeroMemory(m_resolved, allocedBytes);
    }

    // Iterate through each frame in the call stack.
    for (UINT32 frame = 0; frame < m_size; frame++)
    {
        // Try to get the source file and line number associated with
        // this program counter address.
        SIZE_T programCounter = (*this)[frame];
        DWORD            displacement = 0;

        // It turns out that calls to SymGetLineFromAddrW64 may free the very memory we are scrutinizing here
        // in this method. If this is the case, m_Resolved will be null after SymGetLineFromAddrW64 returns.
        // When that happens there is nothing we can do except crash.
        DbgTrace(L"dbghelp32.dll %i: SymGetLineFromAddrW64\n", GetCurrentThreadId());
        BOOL foundline = g_DbgHelp.SymGetLineFromAddrW64(g_currentProcess, programCounter, &displacement, &sourceInfo, locker);

        if (skipStartupLeaks && foundline && !isDynamicInitializer &&
            !(m_status & CALLSTACK_STATUS_NOTSTARTUPCRT) && isCrtStartupModule(sourceInfo.FileName)) {
            m_status |= CALLSTACK_STATUS_STARTUPCRT;
            delete[] m_resolved;
            m_resolved = NULL;
            m_resolvedCapacity = 0;
            m_resolvedLength = 0;
            return 0;
        }

        bool isFrameInternal = false;
        if (foundline && !showInternalFrames) {
            if (isInternalModule(sourceInfo.FileName)) {
                // Don't show frames in files internal to the heap.
                isFrameInternal = true;
            }
        }

        // show one allocation function for context
        if (NumChars > 0 && !isFrameInternal && isPrevFrameInternal) {
            m_resolvedLength += NumChars;
            if (m_resolved) {
                wcsncat_s(m_resolved, m_resolvedCapacity, stack_line, NumChars);
            }
        }
        isPrevFrameInternal = isFrameInternal;

//.........这里部分代码省略.........
开发者ID:viknash,项目名称:vld,代码行数:101,代码来源:callstack.cpp


示例13: VLDMarkThreadLeaksAsReported

__declspec(dllexport) void VLDMarkThreadLeaksAsReported (UINT threadId)
{
    g_vld.MarkThreadLeaksAsReported(threadId);
}
开发者ID:HanLuo,项目名称:pskynet,代码行数:4,代码来源:vldapi.cpp


示例14: VLDGetLeaksCount

__declspec(dllexport) UINT VLDGetLeaksCount ()
{
    return (UINT)g_vld.GetLeaksCount();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例15: VLDGetModulesList

__declspec(dllexport) BOOL VLDGetModulesList(WCHAR *modules, UINT size)
{
    return g_vld.GetModulesList(modules, size);
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例16: VLDMarkAllLeaksAsReported

__declspec(dllexport) void VLDMarkAllLeaksAsReported ()
{
    g_vld.MarkAllLeaksAsReported();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例17: VLDSetReportOptions

__declspec(dllexport) void VLDSetReportOptions(UINT option_mask, CONST WCHAR *filename)
{
    g_vld.SetReportOptions(option_mask,filename);
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例18: VLDDisableModule

__declspec(dllexport) void VLDDisableModule(HMODULE module)
{
    g_vld.DisableModule(module);
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例19: VLDResolveCallstacks

__declspec(dllexport) void VLDResolveCallstacks()
{
    g_vld.ResolveCallstacks();
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp


示例20: VLDGetReportFilename

__declspec(dllexport) void VLDGetReportFilename(WCHAR *filename)
{
    g_vld.GetReportFilename(filename);
}
开发者ID:JOSE89,项目名称:DamnedSunset,代码行数:4,代码来源:vldapi.cpp



注:本文中的VisualLeakDetector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VisualNode类代码示例发布时间:2022-05-31
下一篇:
C++ VisualGraphics类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap