Is the memory block allocated by a thread is on the same affinity as the thread itself until the thread exit?
Is the memory block allocated by a thread is on the same affinity as the thread itself until the thread exit? This is a question about NUMA. For example, in the code below, is the buffer allocated at the local memory of the thread/process throughout its life? for (int th = 0; th < maxThreads; th++) { threads[th] = std::thread([&, th] { int* buffer = new int[1000]; // do something delete buffer; } } Update: to make the question more straightforward, let me ask in this way. If I have 10 simultaneous threads (say, t0 to t9) launched, and within the scope of each threads, it allocates a memory block(say, m0 to m9). Would thread t_n always operates on m_n (n from 0 to 9) before the thread exit, or thread 0 might migrate and operate on memory 9? The memory block in my situation is not very large, usually only a couple of mega-bytes. This will be implementation specific; what is your compiler? ...