Improve the classs cleanup code when using valgrind

This commit is contained in:
Cary R 2013-12-03 09:14:18 -08:00
parent 9544cb516d
commit ae90da9951
3 changed files with 8 additions and 1 deletions

View File

@ -387,6 +387,12 @@ class_type::class_type(const string&nam, size_t nprop)
instance_size_ = 0;
}
class_type::~class_type()
{
for (size_t idx = 0 ; idx < properties_.size() ; idx += 1)
delete properties_[idx].type;
}
void class_type::set_property(size_t idx, const string&name, const string&type)
{
assert(idx < properties_.size());

View File

@ -39,6 +39,7 @@ class class_type : public __vpiHandle {
public:
explicit class_type(const std::string&nam, size_t nprop);
~class_type();
// This is the name of the class type.
inline const std::string&class_name(void) const { return class_name_; }

View File

@ -132,8 +132,8 @@ void root_table_delete(void)
for (unsigned idx = 0; idx < vpip_root_table_cnt; idx += 1) {
struct __vpiScope *scope = static_cast<__vpiScope *>
(vpip_root_table_ptr[idx]);
delete_sub_scopes(scope);
vthreads_delete(scope);
delete_sub_scopes(scope);
delete scope;
}
free(vpip_root_table_ptr);