hi
i have a code:
I found that after exiting from child thread memory isn't freed. I commented everything which is "some actions" here, so thread's function contains only two lines. But it doesn't help.
What do I do wrong?
Thanks a lot
hi
i have a code:
I found that after exiting from child thread memory isn't freed. I commented everything which is "some actions" here, so thread's function contains only two lines. But it doesn't help.
What do I do wrong?
Thanks a lot
I'm not understanding the problem. From what you describe, you seem to think that you have seen memory being given up by a process after a thread exits. Or have you actually seen that? I suspect not.
UNIX does not relinquish memory like that. Each process holds onto any memory it gets during runtime, and releases it only during process rundown. Process memory may get written to swap if main memory is full.
Edit:
One extra thought - early Linux kernels (before 2.4 I think) implemented "threads" essentially as separate processes, for example. When those threads exited, you got memory back. Is that what you mean?
I meant that memory which was allocated on thread's creating was freed only after process terminating so after child thread finished system didn't reuse its resources but kept them hm.. "inaccessible".
But I've already got the answer. I didn't detach threads
Stupid, yeah?
So called dead threads.