开发者

Does operator new allocate on THREAD heap?

开发者 https://www.devze.com 2022-12-23 02:35 出处:网络
My problem seems to be this: heap data allocated by one thread (that later dies) seems to die as well. As so:

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 u开发者_C百科se 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!

Edit: the problem was caused by an unrelated crash bug.


Do threads have a distinct heap?
This thread has some good information regarding this subject

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号