fix memory leak caused by improper process destruction
This commit is contained in:
parent
63635b5f06
commit
d7a8e8ae57
|
@ -27,6 +27,8 @@ struct Process *Process(size_t proc_id,
|
|||
size_t total_pages_owned,
|
||||
size_t ws_size);
|
||||
|
||||
void PROCESS_destroy(struct Process *p);
|
||||
|
||||
size_t PROCESS_run_for(struct Process *p, size_t time_bits);
|
||||
void PROCESS_change_working_set(struct Process *p);
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ RUNQ_remove_current_process(void)
|
|||
break;
|
||||
}
|
||||
|
||||
free(tp);
|
||||
PROCESS_destroy(tp);
|
||||
runq->proc_amount--;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,14 @@ Process(size_t proc_id, size_t max_accesses, size_t total_pages_owned, size_t ws
|
|||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
PROCESS_destroy(struct Process *p)
|
||||
{
|
||||
free(p->pt);
|
||||
free(p->ws);
|
||||
free(p);
|
||||
}
|
||||
|
||||
size_t
|
||||
PROCESS_run_for(struct Process *p, size_t time_bits)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue