title: In C++, can new in one thread allocate the memory deleted by another thread?
body: <p><a href="https://sploitfun.wordpress.com/2015/02/10/understanding-glibc-malloc/" rel="noreferrer">In glibc, <code>malloc</code> is implemented with arenas</a>. 
  So, for example, it is possible that the memory first allocated by <code>malloc</code> and later <code>free</code>d in thread A can not be used by another call of <code>malloc</code> in thread B, since thread A and B may be in different arenas, and different arenas maintain different heaps and free lists of memory. </p>
  
  <p>When it comes to C++ (maybe also C++11 since C++11 has a new standard), is the story still the same? </p>
  
  <p>Or different threads actually share the same segment of heap and free list of memory, and <code>new</code> in one thread can allocate the memory first <code>new</code>ed and later <code>delete</code>d by another thread?</p>
  
  <p>If the answer is implementation dependent, then the question is how are they implemented in the major C++ compilers, such as g++, MVC++, icc?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I think this question is valid in the sense that sometimes you launch many 
  threads and in each thread you dynamically allocate/deallocate a big chunk of memory for a large number of objects, and you don't want the memory usage by your application to go ridiculously high. </p>