SWDEV-403050: Multiple fixes for Memory Leaks in profiler

Change-Id: Ib720a81105af13898ff745ce0cbc2a48c1f4a980
Tá an tiomantas seo le fáil i:
Ammar ELWazir údaraithe agus Ammar ELWazir tiomanta 2023-05-30 21:41:54 -05:00
1 tuismitheoir 00ecca25c7
tiomantas 08fc21ac31
26 comhad athraithe
+673 -592

Níor tháinig aon chomhaid le do chuardach

+3 -2
Féach ar an gComhad
@@ -23,6 +23,7 @@
#include <algorithm>
#include <atomic>
#include "rocprofiler.h"
#include "src/api/rocmtool.h"
namespace Memory {
@@ -68,8 +69,8 @@ GenericBuffer::GenericBuffer(rocprofiler_session_id_t session_id, rocprofiler_bu
GenericBuffer::~GenericBuffer() {
if (is_valid_.load(std::memory_order_release)) {
std::lock_guard lock(buffer_lock_);
if (rocmtools::GetROCMToolObj()->GetSession(session_id_))
rocmtools::GetROCMToolObj()->GetSession(session_id_)->DisableTools(id_);
// if (rocmtools::GetROCMToolObj()->GetSession(session_id_))
// rocmtools::GetROCMToolObj()->GetSession(session_id_)->DisableTools(id_);
Flush();
+3 -3
Féach ar an gComhad
@@ -75,8 +75,7 @@ class GenericBuffer {
}
// Store data in the record. Copy the data first if it fits in the buffer
// (reserve_data_size != 0).
if (reserve_data_size) {
if (reserve_data_size != 0) {
data_ptr_ -= data_size;
::memcpy(data_ptr_, data, data_size);
store_data(record, data_ptr_);
@@ -160,7 +159,8 @@ class GenericBuffer {
std::mutex buffer_lock_;
};
bool GetNextRecord(const rocprofiler_record_header_t* record, const rocprofiler_record_header_t** next);
bool GetNextRecord(const rocprofiler_record_header_t* record,
const rocprofiler_record_header_t** next);
} // namespace Memory
#endif // SRC_CORE_MEMORY_GENERIC_BUFFER_H_