0
Memory layout for thread
How thread memory is allocated ? Does all thread have seperate individual stack ? Is heap common across all thread?
6 Réponses
0
Thanks Martin Taylor ..
Is below understanding correct?
1. local to thread i.e. variables declared inside function are always thread safe as those are on stack of thread
2. Global and static variables are not automatically thread safe as they go to common storage rather than stack.
3. Any function having heap allocated memory is not automatically thread safe.
0
Is it not true ?
Assume that function test has 100 lines of code. On line 1 , I am doing new and on line 100, I am having delete statement.
Suppose this function is used for thread callable, so is not have high chance that one thread may allocate and other thread still feel that memory is not allocated ?
0
Thanks Martin Taylor