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++ Core » Problems with UPP_HEAP in multi-threaded
Problems with UPP_HEAP in multi-threaded [message #16367] Tue, 10 June 2008 21:49 Go to previous message
cocob is currently offline  cocob
Messages: 156
Registered: January 2008
Experienced Member
Hello all

One more time, sorry for my english low skill, ...

I have some problems with UPP Core package in multi-threaded.

I have a package which use STL (strings, vectors, ...) Its functions works perfectly in an app with a single thread but in multithreaded i get a crash "Invalid memory access". It seems to come from overloaded function for HEAP (new, delete) which are use in STL for example in std::string::append().

Here a little example producing my problems.

My config : Debian lenny x86 UPP SVN r284

#include <Core/Core.h>
#include <iostream>

using namespace Upp;

class test
{
public:
	typedef test CLASSNAME;
	void loop();
	void start();	
};

void test::start()
{
	Thread().Start(THISBACK(loop));
}

void test::loop()
{
	std::string str;
	while(true)
	{
		Thread().Sleep(200);
		str.append("test");
		std::cout << "loop" << std::endl;
	}
}

CONSOLE_APP_MAIN
{
	(new test)->start();
	
	while(true)
	{
		Thread().Sleep(500);
		std::cout << "Wait..." << std::endl;
	}
}


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: DEFAULT_MAX_CONTENT_SIZE or max_content_size
Next Topic: Smart pointer: Garbage collected by reference counting
Goto Forum:
  


Current Time: Sat Apr 27 14:19:50 CEST 2024

Total time taken to generate the page: 0.03205 seconds