Author: Gerd Isenberg
Date: 01:46:06 10/08/02
Go up one level in this thread
On October 08, 2002 at 01:00:31, James Robertson wrote: >I am writing a C++ program for one of my classes and the professor informed us >that we must use malloc/free instead of new/delete as new/delete are not thread >safe. The program is using POSIX threads. Can anyone confirm or deny that new >and delete are in fact no-nos in multithreading? > >James Hi James, whether new/delete are thread safe or not is IMHO depending on the implementation of new/delete of a specific class or baseclass. It might be specially a problem in debug (DEBUGNEW) versions, where some compilers keep a chained list of pointers, to detect memory leaks. If malloc/free are reentrant, it should be possible to overload the new/delete operator in your own classes to make them thread safe. But using new/delete for arrays of scalare types might be a problem in debug versions. Cheers, Gerd
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.