Click here to Skip to main content
15,889,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:-
C++
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;


What I have tried:

Have tried on windows debug build. But the size does not reduce once logging is stopped.
Posted
Updated 22-Dec-16 7:55am
v2
Comments
Jochen Arndt 14-Dec-16 3:35am    
The task manager is not suitable for detecting the real amount of memory used by an application. While it shows increasing memory usage when more memory is requested, the displayed usage does not always reflect the real usage when memory is released.

Your observation might be an indication for a memory leak but does not tell you that there is one definitely.

So you should use other methods to check if there is a memory leak. If there is one, it is probably not in the Boost library but somewhere in your code.
Albert Holguin 22-Dec-16 14:33pm    
Have you tried flushing? Believe there's also an "auto_flush" variable you can enable so that streams are flushed every time you pass something... fyi, if logging a lot, this feature can actually slow things down, hence it being disabled by default.

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900