c++ - Will the memory in the heap be released when I do pthread_cancel on iOS? -


lets have allocated memory in background thread, is, thread stack holding pointer memory. want terminate background thread execution calling pthread_cancel on it. memory released or not? (my platform ios, compiler gcc 4.2)

each thread necessity requires own stack; there typically 1 heap per process. when thread destroyed, there no automatic mechanism free memory allocated on heap. end memory leak.

as general rule, avoid using pthread_cancel since hard ensure pthread_cancel run safely. rather build in mechanism can pass message thread destroy (after freeing resources owns).


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -