Does operator new allocate on THREAD heap?

Posted by Jonas Byström on Stack Overflow See other posts from Stack Overflow or by Jonas Byström
Published on 2010-03-15T08:51:37Z Indexed on 2010/03/15 8:59 UTC
Read the original article Hit count: 308

Filed under:
|
|
|
|

My problem seems to be this: heap data allocated by one thread (that later dies) seems to die as well. As so:

  1. Thread X: starts
  2. Thread Y: starts
  3. Thread X: ptr = new some bytes
  4. Thread X: dies
  5. Thread Y: tries to use ptr - and crashes!

So far, I've only seen this problem on Darwin (Mac OS 10.5 and 10.6), but haven't tried more other platforms than Windows and Linux (Ubuntu) where it works as expected. I've had this problem for some time, so any know-how or more information about this is highly appreciated!

© Stack Overflow or respective owner

Related posts about heap

Related posts about multithreading