Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » What's wrong in this code? (Heap leaks detected)
What's wrong in this code? [message #45178] Wed, 23 September 2015 11:36 Go to next message
charlie is currently offline  charlie
Messages: 2
Registered: September 2015
Junior Member
#include <Core/Core.h>
using namespace Upp;

void Test()
{
for(int i = 0 ; i< 30 ; i++){
puts("hello world!\r\n");
Sleep(1000);
}
return;
}

CONSOLE_APP_MAIN
{
Thread::Start(callback(Test));
}

//When I run the application. pop a warnning dialog "Heap leaks detected!"; Why?
Re: What's wrong in this code? [message #45180 is a reply to message #45178] Wed, 23 September 2015 17:16 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

I think your application ends before the Thread finishes it's execution.

You can try something like this:
CONSOLE_APP_MAIN
{
Thread t;
t.Run(callback(Test));
t.Wait();
}


Alternatively, you could just wait in loop checking Thread::GetCount() in your main function.

Best regards,
Honza
Previous Topic: Printing on raspberry Pi 2
Next Topic: msvc10 64 automatic setup does not work
Goto Forum:
  


Current Time: Sun Sep 22 20:15:54 CEST 2019

Total time taken to generate the page: 0.03896 seconds