Hello,

Brian Mckinnon wrote:

>       The last time it happened to me I did a pretty heavy analysis on
> the problem, and I saw that memory addresses which had been freed by
> one thread were being used by another.  I really wish I kept that
> output file.  The only way I could fix the problem was to use a thread
> safe factory to create and free the memory.

It's not a matter of thread safety to ensure that one thread does not
delete objects used in other threads. The very same problem of creating
dangling pointers or references exists in single-threaded environments.
It would be interesting to know, what your "thread-safe factory" really
does. My bet is, it does more than just arbitrarily serializing
creating and deleting objects, which is what would be expected from the
name.

> Is there a way to override the new and delete functions, or enable 
> some form of malloc debugging so I can at least try and identify the
> issue.

If you are on a supported platform, try valgrind. Compile with debug
infos.

Bernd Strieder



_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to