Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Thread safe gcc 3.2.2

Status
Not open for further replies.

dchinom

Programmer
Dec 14, 2005
2
US
Hi,

I am creating a multi-threaded application, but I keep getting segmentation faults, which I believe are a product of memory allocation/deletions across mutliple threads.

Is there a flag or directive that can be specified so gcc compiler will use thread safe memory operations?

Regards,
Doug M.
 
Are you using some mutexes or semaphores to lock code that should only be run by one thread at a time?
 
> I am creating a multi-threaded application
Did you link with all the threading libraries, and compile with all the threading options?

> which I believe are a product of memory allocation/deletions across mutliple threads.
Did you write a test application containing a number of threads that just call malloc() and free() over an extended period of time to test your hypothesis?

Have you tried memory debuggers like electric fence or valgrind to see if it's not simply a matter of running off the end of some allocation or other.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top