mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Add deletions to tracking list if malloc or new (#1778)
* Add deletions to tracking list if malloc or new * Add all TRICK_LOCAL deletions to deletion_list
This commit is contained in:
parent
077064f225
commit
1a842a6b89
@ -37,19 +37,18 @@ 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.
|
||||
deleted_addr_list.push_back(address);
|
||||
|
||||
free( address);
|
||||
} else if ( alloc_info->alloc_type == TRICK_ALLOC_NEW ) {
|
||||
io_src_delete_class( alloc_info );
|
||||
|
Loading…
Reference in New Issue
Block a user