Skip to content
Snippets Groups Projects
Commit 1f68d677 authored by Nadav Har'El's avatar Nadav Har'El
Browse files

Free TCB (and thread-local storage) area on thread destruction.

We forgot to free the TCB allocated buffer on thread destruction, causing
a leak of around 1000 bytes per thread creation. We still have another
leak (exactly one page per thread object creation) that I'm trying to find :(
parent 70cee8e0
No related branches found
No related tags found
No related merge requests found
......@@ -93,6 +93,11 @@ void thread::setup_tcb()
_tcb->tls_base = p;
}
void thread::free_tcb()
{
free(_tcb->tls_base);
}
void thread_main_c(thread* t)
{
s_current = t;
......
......@@ -276,6 +276,7 @@ thread::~thread()
if (_attr.stack.deleter) {
_attr.stack.deleter(_attr.stack.begin);
}
free_tcb();
}
void thread::start()
......
......@@ -175,6 +175,7 @@ private:
void stop_wait();
void init_stack();
void setup_tcb();
void free_tcb();
void complete();
void suspend_timers();
void resume_timers();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment