mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 06:23:01 +08:00
We can step into false-positive memory leak if we reassign global variables which assume memory allocations, for example std::string. Our unit tests has embedded memory leak detector which gets inited/destroyed somewhere in the middle of the test run. Hence allocations/deallocations done before/after its active livetime will be transparent for it. This particular case reassigned std::string global variable to the same value. Apperantly my version of libstdc++ (the one on CentOS 7) did not recognize that input/output string size is actually the same. Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> https://github.com/intel/compute-runtime/pull/144 Change-Id: Iaab42588f59691d3085a4f8879d902076dcee0fb
34 lines
1.0 KiB
C++
34 lines
1.0 KiB
C++
/*
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "third_party/aub_stream/headers/aub_manager.h"
|
|
#include "third_party/aub_stream/headers/options.h"
|
|
|
|
namespace aub_stream_stubs {
|
|
uint16_t tbxServerPort = 4321;
|
|
std::string tbxServerIp = "127.0.0.1";
|
|
} // namespace aub_stream_stubs
|
|
|
|
namespace aub_stream {
|
|
|
|
AubManager *AubManager::create(uint32_t productFamily, uint32_t devicesCount, uint64_t memoryBankSizeInGB, bool localMemorySupported, uint32_t streamMode) {
|
|
return nullptr;
|
|
}
|
|
|
|
extern "C" {
|
|
void injectMMIOList(MMIOList mmioList){};
|
|
void setTbxServerPort(uint16_t port) { aub_stream_stubs::tbxServerPort = port; };
|
|
void setTbxServerIp(std::string server) {
|
|
// better to avoid reassigning global variables which assume memory allocations since
|
|
// we could step into false-positive memory leak detection with embedded leak check helper
|
|
if (aub_stream_stubs::tbxServerIp != server)
|
|
aub_stream_stubs::tbxServerIp = server;
|
|
};
|
|
}
|
|
|
|
} // namespace aub_stream
|