From 8977248ee216a183287d76ce5a6565fa91d22c2f Mon Sep 17 00:00:00 2001 From: Cary R Date: Sun, 16 Oct 2011 11:05:23 -0700 Subject: [PATCH] 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. --- vvp/vvp_net.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index e11504cc9..d0128940e 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -34,6 +34,7 @@ # include # include # 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_map; static map sfunc_map; +static map 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 (item->fun)) { sfunc_map[tmp] = true; } + if (vvp_udp_fun_core*tmp = dynamic_cast (item->fun)) { + udp_map[tmp] = true; + } } void vvp_net_pool_delete() @@ -128,6 +133,12 @@ void vvp_net_pool_delete() } sfunc_map.clear(); + map::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).",