Added thread stack memory leak check to vvp.

When a vvp thread terminates, its real and string stacks should be empty.
Adding assertions to this effect catches some code generator bugs.
This commit is contained in:
Martin Whitaker 2013-05-18 19:02:36 +01:00
parent 5e94554d72
commit 0aca19356c
1 changed files with 8 additions and 1 deletions

View File

@ -217,6 +217,13 @@ struct vthread_s {
/* These are used to pass non-blocking event control information. */
vvp_net_t*event;
uint64_t ecount;
inline void cleanup()
{
bits4 = vvp_vector4_t();
assert(stack_real_.empty());
assert(stack_str_.empty());
}
};
inline vthread_s::vthread_s()
@ -618,7 +625,7 @@ static void vthread_reap(vthread_t thr)
void vthread_delete(vthread_t thr)
{
thr->bits4 = vvp_vector4_t();
thr->cleanup();
delete thr;
}