Finding Memory leaks in VS 2013 release build while using Deleaker in the following code. Are they really...












6















I am using Deleaker tool to find the memory leaks in my application.



Below are the code snippet files where I am getting the memory leaks.



class FileManager
{

.....
std::fstream _dfs;
std::mutex _dmutex;
Write(const char *l_charbuffer);
.....

};

void FileManager::Write(const char *l_charbuffer)
{

std::unique_lock<std::mutex> lock(_dmutex);
_dfs << l_charbuffer << endl;
}


class LogManager
{

.....
Initialize(const char *l_charbuffer);
.....

};

LogManager::Initialize()
{

.....
std::thread logexcpthread(&LogManager::ExcpThread, this);
.....
}


When I am running my application in the Release build, Deleaker tool has shown memory leaks in the following lines:



std::unique_lock<std::mutex> lock(_dmutex); // Write method of FileManager

std::thread logexcpthread(&LogManager::ExcpThread, this); // Initialize method of LogManager


I am not sure are those really memory leaks or not? If anyone has come across this kind of problem, please help me on this?



Is there a tool limitation in Release build for this kind of code?



Note: But I have not seen these memory leaks in Debug build.










share|improve this question

























  • VS 2013 is an old compiler. Us VS 2017.

    – user2672107
    Feb 5 '18 at 14:09











  • what's LogManager::ExcpThread. code is missing pieces. as it presented now main thing is that your thread you create is a local object with life ending at exit from Initialize, unless you move it somewhere else. something probably creates copy of manager class (and of mutex), that may explain other warning.

    – Swift - Friday Pie
    Feb 5 '18 at 16:03






  • 4





    Deleaker's author here. It's a good idea to share call stacks for these false positives. It's highly likely that it's some kind of one-time-initialization - to check it just add additional variable of type std::unique_lock<std::mutex>. Does it add some leak?

    – Artem Razin
    Jan 18 at 15:22
















6















I am using Deleaker tool to find the memory leaks in my application.



Below are the code snippet files where I am getting the memory leaks.



class FileManager
{

.....
std::fstream _dfs;
std::mutex _dmutex;
Write(const char *l_charbuffer);
.....

};

void FileManager::Write(const char *l_charbuffer)
{

std::unique_lock<std::mutex> lock(_dmutex);
_dfs << l_charbuffer << endl;
}


class LogManager
{

.....
Initialize(const char *l_charbuffer);
.....

};

LogManager::Initialize()
{

.....
std::thread logexcpthread(&LogManager::ExcpThread, this);
.....
}


When I am running my application in the Release build, Deleaker tool has shown memory leaks in the following lines:



std::unique_lock<std::mutex> lock(_dmutex); // Write method of FileManager

std::thread logexcpthread(&LogManager::ExcpThread, this); // Initialize method of LogManager


I am not sure are those really memory leaks or not? If anyone has come across this kind of problem, please help me on this?



Is there a tool limitation in Release build for this kind of code?



Note: But I have not seen these memory leaks in Debug build.










share|improve this question

























  • VS 2013 is an old compiler. Us VS 2017.

    – user2672107
    Feb 5 '18 at 14:09











  • what's LogManager::ExcpThread. code is missing pieces. as it presented now main thing is that your thread you create is a local object with life ending at exit from Initialize, unless you move it somewhere else. something probably creates copy of manager class (and of mutex), that may explain other warning.

    – Swift - Friday Pie
    Feb 5 '18 at 16:03






  • 4





    Deleaker's author here. It's a good idea to share call stacks for these false positives. It's highly likely that it's some kind of one-time-initialization - to check it just add additional variable of type std::unique_lock<std::mutex>. Does it add some leak?

    – Artem Razin
    Jan 18 at 15:22














6












6








6


4






I am using Deleaker tool to find the memory leaks in my application.



Below are the code snippet files where I am getting the memory leaks.



class FileManager
{

.....
std::fstream _dfs;
std::mutex _dmutex;
Write(const char *l_charbuffer);
.....

};

void FileManager::Write(const char *l_charbuffer)
{

std::unique_lock<std::mutex> lock(_dmutex);
_dfs << l_charbuffer << endl;
}


class LogManager
{

.....
Initialize(const char *l_charbuffer);
.....

};

LogManager::Initialize()
{

.....
std::thread logexcpthread(&LogManager::ExcpThread, this);
.....
}


When I am running my application in the Release build, Deleaker tool has shown memory leaks in the following lines:



std::unique_lock<std::mutex> lock(_dmutex); // Write method of FileManager

std::thread logexcpthread(&LogManager::ExcpThread, this); // Initialize method of LogManager


I am not sure are those really memory leaks or not? If anyone has come across this kind of problem, please help me on this?



Is there a tool limitation in Release build for this kind of code?



Note: But I have not seen these memory leaks in Debug build.










share|improve this question
















I am using Deleaker tool to find the memory leaks in my application.



Below are the code snippet files where I am getting the memory leaks.



class FileManager
{

.....
std::fstream _dfs;
std::mutex _dmutex;
Write(const char *l_charbuffer);
.....

};

void FileManager::Write(const char *l_charbuffer)
{

std::unique_lock<std::mutex> lock(_dmutex);
_dfs << l_charbuffer << endl;
}


class LogManager
{

.....
Initialize(const char *l_charbuffer);
.....

};

LogManager::Initialize()
{

.....
std::thread logexcpthread(&LogManager::ExcpThread, this);
.....
}


When I am running my application in the Release build, Deleaker tool has shown memory leaks in the following lines:



std::unique_lock<std::mutex> lock(_dmutex); // Write method of FileManager

std::thread logexcpthread(&LogManager::ExcpThread, this); // Initialize method of LogManager


I am not sure are those really memory leaks or not? If anyone has come across this kind of problem, please help me on this?



Is there a tool limitation in Release build for this kind of code?



Note: But I have not seen these memory leaks in Debug build.







c++ c++11 memory memory-management






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 16:09









Artem Razin

850516




850516










asked Feb 5 '18 at 13:42









Vijaya kumar ReddyVijaya kumar Reddy

311




311













  • VS 2013 is an old compiler. Us VS 2017.

    – user2672107
    Feb 5 '18 at 14:09











  • what's LogManager::ExcpThread. code is missing pieces. as it presented now main thing is that your thread you create is a local object with life ending at exit from Initialize, unless you move it somewhere else. something probably creates copy of manager class (and of mutex), that may explain other warning.

    – Swift - Friday Pie
    Feb 5 '18 at 16:03






  • 4





    Deleaker's author here. It's a good idea to share call stacks for these false positives. It's highly likely that it's some kind of one-time-initialization - to check it just add additional variable of type std::unique_lock<std::mutex>. Does it add some leak?

    – Artem Razin
    Jan 18 at 15:22



















  • VS 2013 is an old compiler. Us VS 2017.

    – user2672107
    Feb 5 '18 at 14:09











  • what's LogManager::ExcpThread. code is missing pieces. as it presented now main thing is that your thread you create is a local object with life ending at exit from Initialize, unless you move it somewhere else. something probably creates copy of manager class (and of mutex), that may explain other warning.

    – Swift - Friday Pie
    Feb 5 '18 at 16:03






  • 4





    Deleaker's author here. It's a good idea to share call stacks for these false positives. It's highly likely that it's some kind of one-time-initialization - to check it just add additional variable of type std::unique_lock<std::mutex>. Does it add some leak?

    – Artem Razin
    Jan 18 at 15:22

















VS 2013 is an old compiler. Us VS 2017.

– user2672107
Feb 5 '18 at 14:09





VS 2013 is an old compiler. Us VS 2017.

– user2672107
Feb 5 '18 at 14:09













what's LogManager::ExcpThread. code is missing pieces. as it presented now main thing is that your thread you create is a local object with life ending at exit from Initialize, unless you move it somewhere else. something probably creates copy of manager class (and of mutex), that may explain other warning.

– Swift - Friday Pie
Feb 5 '18 at 16:03





what's LogManager::ExcpThread. code is missing pieces. as it presented now main thing is that your thread you create is a local object with life ending at exit from Initialize, unless you move it somewhere else. something probably creates copy of manager class (and of mutex), that may explain other warning.

– Swift - Friday Pie
Feb 5 '18 at 16:03




4




4





Deleaker's author here. It's a good idea to share call stacks for these false positives. It's highly likely that it's some kind of one-time-initialization - to check it just add additional variable of type std::unique_lock<std::mutex>. Does it add some leak?

– Artem Razin
Jan 18 at 15:22





Deleaker's author here. It's a good idea to share call stacks for these false positives. It's highly likely that it's some kind of one-time-initialization - to check it just add additional variable of type std::unique_lock<std::mutex>. Does it add some leak?

– Artem Razin
Jan 18 at 15:22












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48623943%2ffinding-memory-leaks-in-vs-2013-release-build-while-using-deleaker-in-the-follow%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48623943%2ffinding-memory-leaks-in-vs-2013-release-build-while-using-deleaker-in-the-follow%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage