I have used pthread_detach inorder to free up the stack allocated to the child thread, but this is not working, I guess it does not free up the memory…..
I don’t want to use pthread_join. I know join assures me of freeing up the stack for child, but, I don’t want the parent to hang up until the child thread terminates, I want my parent to do some other work in the mean time. So, I have used detach, as it will not block the parent thread.
Please, help me. I have been stuck..
Yes it is. You are likely mis-interpreting your observations.
That’s usually the reason to create threads in the first place, and you can do that:
Above statement is false: it assures no such thing. A common implementation will cache the now available child stack for reuse (in case you’ll create another thread shortly).