如何解决boost logger中的内存泄漏问题? [英] How to solve memory leak issue in boost logger?

查看:253
本文介绍了如何解决boost logger中的内存泄漏问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在任务管理器中使用BOOST进行日志记录时,内存大小会不断增加,但不会删除它。例如,如果我打印6000 * 24倍的任务管理器中的.exe(内存)的大小增加,直到它记录的时间。有没有办法释放内存以获得提升。使用BOOST_LOG_SEV进行日志记录。我可以用任何方式清理内存吗?

运行windows debug build ....我使用下面的代码: -

While logging using BOOST in task manager the size of memory keeps on increasing it does not delete it. For example if I print 6000 * 24 times the size of .exe(memory) in task manager is increased till the time its logged. Is there any way to free up the memory for boost. using BOOST_LOG_SEV for logging. can i clean up memory in any way??
running for windows debug build....and I am using the below code:-

src::severity_logger< severity_level > slg;
    slg.add_attribute("Function", attrs::constant< std::string >(strFuncName));
    slg.add_attribute("FileName", attrs::constant< std::string >(strFileName));
    slg.add_attribute("Line", attrs::constant<int >(lineNo));

    case SEVERITY_LOGINFO:
        BOOST_LOG_SEV(slg, info) << strMessageString;
        break;





我尝试过什么:



尝试过windows debug build。但是一旦停止记录,大小就不会减少。



What I have tried:

Have tried on windows debug build. But the size does not reduce once logging is stopped.

推荐答案

检测内存泄漏并不容易,所以如果你真的想要这样做,你需要一些工具。我会先尝试联系一些知识渊博的人。



有时候,任务经理在第一眼看上去很傻。阅读此处如何查找内存泄漏。如果你想深入挖掘,你可能会发现这里一些有用的工具。



我个人会尽量避免这项工作,因为这些好处可能无法付出代价。所以我会尝试更简单的日志记录或使用其他日志工具。
Detecting memory leaks isnt easy, so you need some tools if you really want to do it. I would try at first to contact some people with deep boost knowledege.

Sometimes the task manager is fooling at the first look. Read here how to find memory leaks. And if you want to dig deeper you may find here some useful tool.

I personally would try to avoid this work, because the benefits may not pay for the effort. So I would try to do more simpler logging or use other logging tools.


这篇关于如何解决boost logger中的内存泄漏问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆