fqucuo 2015-11-09 15:13 采纳率: 100%
浏览 1686
已采纳

boost filesystem memory leak!

int main(int argc, char* argv[])
{
    _CrtSetBreakAlloc(284);
    {
        boost::filesystem::path p(argv[0]);
        std::string b = p.extension().generic_string();;
    }
    _CrtDumpMemoryLeaks();
    return 0;
}

下面是output显示的内容, 分两部分, 一部分是用_CrtDumpMemoryLeaks()显示的两个泄漏点, 这两个点分别是extension()里用到的path, 从内存申请点断点来看, 确实没有释放; 另外我安装了最新版的Visual Leak Detector, 却显示没有泄漏

 Visual Leak Detector Version 2.4RC2 installed.
Detected memory leaks!
Dumping objects ->
{296} normal block at 0x0081D8E0, 8 bytes long.
 Data: <0 1     > 30 16 31 00 00 00 00 00 
{282} normal block at 0x0081BFD0, 8 bytes long.
 Data: <  1     > 08 16 31 00 00 00 00 00 
Object dump complete.
The thread 0x78 has exited with code 0 (0x0).
The thread 0x2fa4 has exited with code 0 (0x0).
The thread 0x6b0 has exited with code 0 (0x0).
No memory leaks detected.
Visual Leak Detector is now exiting.
  • 写回答

1条回答 默认 最新

  • fqucuo 2015-11-09 15:32
    关注

    问题找到了, extension会调用到dot_path函数, 里面有一个static path, 所以在main内还是显示没释放, 正常

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置