From 87541ce335526e037aa2ddba3f630b6ceb856339 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 3 Feb 2009 17:25:18 -0800 Subject: [PATCH] vpi_free_object() is just a stub for vpiCallback objects. The code was using vpi_free_object() to free a vpiCallback object and that was creating a memory leak since this is a do nothing routine. You need to explicitly use delete. --- vvp/vpi_event.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vvp/vpi_event.cc b/vvp/vpi_event.cc index ae3b80ab5..20849eefc 100644 --- a/vvp/vpi_event.cc +++ b/vvp/vpi_event.cc @@ -109,6 +109,9 @@ vpiHandle vpip_make_named_event(const char*name, vvp_net_t*funct) * vpi_remove_cb doesn't actually remove any callbacks, it marks them * as canceled by clearing the cb_rtn function. This function reaps * those marked handles when it scans the list. + * + * We can not use vpi_free_object() here since it does not really + * delete the callback. */ void vpip_run_named_event_callbacks(vpiHandle ref) { @@ -129,13 +132,13 @@ void vpip_run_named_event_callbacks(vpiHandle ref) } else if (prev == 0) { obj->callbacks = next; cur->next = 0; - vpi_free_object(&cur->base); + delete cur; } else { assert(prev->next == cur); prev->next = next; cur->next = 0; - vpi_free_object(&cur->base); + delete cur; } } }