For valgrind testing remove the UDP functionality object.

When checking with valgrind we need to remove the UDP functionality
object to avoid a reported memory issue.
This commit is contained in:
Cary R 2011-10-16 11:05:23 -07:00 committed by Stephen Williams
parent 7a75f94eda
commit 8977248ee2
1 changed files with 11 additions and 0 deletions

View File

@ -34,6 +34,7 @@
# include <valgrind/memcheck.h>
# include <map>
# include "sfunc.h"
# include "udp.h"
# include "ivl_alloc.h"
#endif
@ -85,6 +86,7 @@ void* vvp_net_t::operator new (size_t size)
#ifdef CHECK_WITH_VALGRIND
static map<vvp_net_t*, bool> vvp_net_map;
static map<sfunc_core*, bool> sfunc_map;
static map<vvp_udp_fun_core*, bool> udp_map;
static vvp_net_t **local_net_pool = 0;
static unsigned local_net_pool_count = 0;
@ -102,6 +104,9 @@ void vvp_net_delete(vvp_net_t *item)
if (sfunc_core*tmp = dynamic_cast<sfunc_core*> (item->fun)) {
sfunc_map[tmp] = true;
}
if (vvp_udp_fun_core*tmp = dynamic_cast<vvp_udp_fun_core*> (item->fun)) {
udp_map[tmp] = true;
}
}
void vvp_net_pool_delete()
@ -128,6 +133,12 @@ void vvp_net_pool_delete()
}
sfunc_map.clear();
map<vvp_udp_fun_core*, bool>::iterator uiter;
for (uiter = udp_map.begin(); uiter != udp_map.end(); ++ uiter ) {
delete uiter->first;
}
udp_map.clear();
if (RUNNING_ON_VALGRIND && (vvp_nets_del != count_vvp_nets)) {
fflush(NULL);
VALGRIND_PRINTF("Error: vvp missed deleting %ld of %lu net(s).",