Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion source/loader/layers/sanitizer/asan/asan_interceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,8 @@ ContextInfo::~ContextInfo() {
assert(Result == UR_RESULT_SUCCESS);

// check memory leaks
if (getAsanInterceptor()->isNormalExit()) {
if (getAsanInterceptor()->getOptions().DetectLeaks &&
getAsanInterceptor()->isNormalExit()) {
std::vector<AllocationIterator> AllocInfos =
getAsanInterceptor()->findAllocInfoByContext(Handle);
for (const auto &It : AllocInfos) {
Expand Down
4 changes: 2 additions & 2 deletions source/loader/layers/sanitizer/asan/asan_interceptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ class AsanInterceptor {
std::shared_ptr<DeviceInfo> &DeviceInfo);

private:
// m_Options may be used in other places, place it at the top
AsanOptions m_Options;
std::unordered_map<ur_context_handle_t, std::shared_ptr<ContextInfo>>
m_ContextMap;
ur_shared_mutex m_ContextMapMutex;
Expand All @@ -324,8 +326,6 @@ class AsanInterceptor {

std::unique_ptr<Quarantine> m_Quarantine;

AsanOptions m_Options;

std::unordered_set<ur_adapter_handle_t> m_Adapters;
ur_shared_mutex m_AdaptersMutex;

Expand Down
1 change: 1 addition & 0 deletions source/loader/layers/sanitizer/asan/asan_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ AsanOptions::AsanOptions() {
SetBoolOption("detect_locals", DetectLocals);
SetBoolOption("detect_privates", DetectPrivates);
SetBoolOption("print_stats", PrintStats);
SetBoolOption("detect_leaks", DetectLeaks);

auto KV = OptionsEnvMap->find("quarantine_size_mb");
if (KV != OptionsEnvMap->end()) {
Expand Down
1 change: 1 addition & 0 deletions source/loader/layers/sanitizer/asan/asan_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct AsanOptions {
bool DetectPrivates = true;
bool PrintStats = false;
bool DetectKernelArguments = true;
bool DetectLeaks = true;

explicit AsanOptions();
};
Expand Down
Loading