[try Beta version]
Not logged in

 
Issues with memory leak

Jan 31, 2019 at 9:56pm
I am using the boost library serialization feature and i am having issues with saving my object data. When i used Visual leak detector i found multiple leaks in the save_object_data() function. I assume that it has to do with something in my class not being destroyed properly but i am not so sure. And i don't know if this is related but when leaving my program to run for an extended period of time it slows down.
Other than that all my code works.


My code:
https://pastebin.com/ykYs8ZLV

Feb 1, 2019 at 12:28am
I don't see any function named 'save_object_data' and I don't see any explicit memory allocations.
Feb 1, 2019 at 2:30am
Thats because that function is declared in another file in a library. I need someone who knows specifically about boost serialization to help me on this issue.

This is a link to the documentation.
https://www.boost.org/doc/libs/1_69_0/libs/serialization/doc/index.html
Feb 1, 2019 at 3:12am
If it's a function in Boost then it's much more likely that the memory debugger is reporting a false positive. A leak report is not enough to conclude that memory leaks exist in a program.
Feb 1, 2019 at 3:53pm
I'm sorry I didn't look at your code, but it's not unusual for vld to report false positives often times as helios mentioned. I've experienced many scenarios where vld would report a number of memory leaks due to one of my classes being a singleton for example.
Feb 2, 2019 at 6:46pm
Run the offending code in as small a sample program as you can build to make it run, and then run the thing in a loop. Pop open the memory tool on your computer (task manager, for example in win) and watch its memory usage. Let it run for a couple hours. Its not 100% foolproof -- could be something different between the test program and the real code -- but Ive found and fixed a number of leaks that way.

A friend of mine once put it this way: memory leak finder programs exist to find leaks. They flag everything that meets a heuristic … and they err on the side of caution... so you get a ton of junk along with the good info.
Last edited on Feb 2, 2019 at 6:48pm
Topic archived. No new replies allowed.