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 » Community » Newbie corner » Using U++ with existing code
Re: Using U++ with existing code [message #24937 is a reply to message #24924] Fri, 05 February 2010 10:17 Go to previous message
mirek is currently offline  mirek
Messages: 14258
Registered: November 2005
Ultimate Member
TRNG98 wrote on Thu, 04 February 2010 14:37

Thank you for your help -- I'll hack around a while --
The C is multi-threaded and run some API functions (not Win API:s).
I don't want to rewrite it. Surprised

// Bo



Multithreaded: There is one thing that you should know: U++ uses own memory allocator that need some support in threads - basically, as allocator keeps per-thread cache, this cache has to be released when thread finishes.

For you, in practice, this should not be a problem, as long as you do not use new/delete in threads of your C application. But new/delete is (likely to be) used if actually call any U++ code from any non-main thread!

Simple way how to fix this is to specify "USEMALLOC" flag - that kicks out our memory allocator and uses plain malloc/free from the C library (but performance of U++ drops - IMO not an issue if you app depends on malloc/free anyway).

Best solution is to use U++ Thread class for threading. Good solution is to release the per-thread cache at the end of your threads (by calling MemoryFreeThread()Wink

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: header file problem
Next Topic: Build error
Goto Forum:
  


Current Time: Wed May 14 11:25:14 CEST 2025

Total time taken to generate the page: 0.01124 seconds