V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
coolcokel
V2EX  ›  问与答

Linux 下Q T 怎么分析内存泄露,搞了半天了,也没找见问题

  •  
  •   coolcokel · 2019-11-19 11:30:43 +08:00 · 1492 次点击
    这是一个创建于 1591 天前的主题,其中的信息可能已经有所发展或是发生改变。
    8 条回复    2019-11-19 14:30:04 +08:00
    liuguangxuan
        1
    liuguangxuan  
       2019-11-19 12:38:53 +08:00 via Android
    Analyze->Valgrind Memory Analyzer.
    coolcokel
        2
    coolcokel  
    OP
       2019-11-19 12:46:43 +08:00
    @ liuguangxuan 程序异常退出了
    12:45:48: 程序异常结束。
    12:45:48: Process exited with return value 进程已崩溃
    v2qwsdcv
        3
    v2qwsdcv  
       2019-11-19 12:56:22 +08:00
    异常退出你怎么知道是内存泄漏的? 大概率是 Segment Fault 搜一艘怎么 crash dump 吧
    jxf2008
        4
    jxf2008  
       2019-11-19 13:14:21 +08:00
    qDebug()<<"11111"
    qDebug()<<"22222"
    qDebug()<<"33333"
    qDebug()<<"44444"
    qDebug()<<"55555"
    配合逐步渐进发或中央分割法
    找到崩溃在哪一行

    反正我一直怎么搞的,花里胡哨的工具很多时候没 debug()大法好
    coolcokel
        5
    coolcokel  
    OP
       2019-11-19 14:03:32 +08:00
    @v2qwsdcv 程序可以运行,内存消耗很快,一会就卡死了。但是 Valgrind Memory Analyzer 就直接报进程崩溃错误了
    coolcokel
        6
    coolcokel  
    OP
       2019-11-19 14:09:23 +08:00
    会不会是Q T Creater 的分析器没有设置好呀
    coolcokel
        7
    coolcokel  
    OP
       2019-11-19 14:11:24 +08:00
    @ jxf2008 已经在这样调了
    coolcokel
        8
    coolcokel  
    OP
       2019-11-19 14:30:04 +08:00
    多谢各位,找到问题了,有个 API 初始化一次就行了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3229 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 14:22 · PVG 22:22 · LAX 07:22 · JFK 10:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.