Skip to content

Commit

Permalink
Add all TRICK_LOCAL deletions to deletion_list
Browse files Browse the repository at this point in the history
  • Loading branch information
excaliburtb committed Sep 16, 2024
1 parent f7f0693 commit 1abb4e7
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,20 @@ int Trick::MemoryManager::delete_var(void* address ) {
MemoryManager allocated it.
*/
if ( alloc_info->stcl == TRICK_LOCAL ) {
if ( alloc_info->alloc_type == TRICK_ALLOC_MALLOC ) {
// The destructor that we just called MAY have deleted addresses
// that are already planned for deletion, say during reset_memory.
// So, keep a record of what we've recently deleted so we don't
// to warn that we can't find it, when reset_memory also tries to
// delete that same address. Same for TRICK_ALLOC_NEW block
deleted_addr_list.push_back(address);

if ( alloc_info->alloc_type == TRICK_ALLOC_MALLOC ) {
// This will call a destructor ONLY if alloc_info->type is TRICK_STRUCTURED.
// Otherwise it does nothing.
io_src_destruct_class( alloc_info );

// The destructor that we just called MAY have deleted addresses
// that are already planned for deletion, say during reset_memory.
// So, keep a record of what we've recently deleted so we don't
// to warn that we can't find it, when reset_memory also tries to
// delete that same address. Same for TRICK_ALLOC_NEW block
deleted_addr_list.push_back(address);

free( address);
} else if ( alloc_info->alloc_type == TRICK_ALLOC_NEW ) {
deleted_addr_list.push_back(address);

io_src_delete_class( alloc_info );
}
}
Expand Down

0 comments on commit 1abb4e7

Please sign in to comment.