mirror of
https://github.com/nasa/trick.git
synced 2025-01-18 18:56:31 +00:00
Remove destroy flag from MemoryManager::delete_var(). #1301
This commit is contained in:
parent
36416c1973
commit
d94d5fc863
@ -301,7 +301,7 @@ namespace Trick {
|
||||
@param address - the address of the variable.
|
||||
@return 0 = SUCCESS, 1 = FAILURE
|
||||
*/
|
||||
int delete_var(void* address, bool destroy = true);
|
||||
int delete_var(void* address);
|
||||
|
||||
/**
|
||||
Forget about the variable with the given name and deallocate the memory associated with it.
|
||||
|
@ -37,10 +37,10 @@
|
||||
return addr ; \
|
||||
} ; \
|
||||
static void operator delete (void *p) { \
|
||||
if ( get_alloc_info_at(p) ) { trick_MM->delete_var(p, false) ; free(p) ; } \
|
||||
if ( get_alloc_info_at(p) ) { trick_MM->delete_var(p) ; free(p) ; } \
|
||||
} ; \
|
||||
static void operator delete[] (void *p) { \
|
||||
if ( get_alloc_info_at(p) ) { trick_MM->delete_var(p, false) ; free(p) ; } \
|
||||
if ( get_alloc_info_at(p) ) { trick_MM->delete_var(p) ; free(p) ; } \
|
||||
} ;
|
||||
#endif
|
||||
|
||||
|
@ -307,7 +307,7 @@ void Trick::MemoryManager::reset_memory() {
|
||||
|
||||
n_addrs = deletion_list.size();
|
||||
for (ii = 0 ; ii < n_addrs ; ii ++) {
|
||||
delete_var( deletion_list[ii], false);
|
||||
delete_var( deletion_list[ii]);
|
||||
}
|
||||
|
||||
// reset counter to 100mil. This (hopefully) ensures all alloc'ed ids are after external variables.
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "trick/MemoryManager.hh"
|
||||
|
||||
// MEMBER FUNCTION
|
||||
int Trick::MemoryManager::delete_var(void* address, bool destroy ) {
|
||||
int Trick::MemoryManager::delete_var(void* address ) {
|
||||
|
||||
if (address == 0) {
|
||||
if (debug_level) {
|
||||
@ -37,9 +37,7 @@ int Trick::MemoryManager::delete_var(void* address, bool destroy ) {
|
||||
*/
|
||||
if ( alloc_info->stcl == TRICK_LOCAL ) {
|
||||
if ( alloc_info->alloc_type == TRICK_ALLOC_MALLOC ) {
|
||||
if (destroy) {
|
||||
io_src_destruct_class( alloc_info );
|
||||
}
|
||||
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