File tree 4 files changed +6
-3
lines changed
source/loader/layers/sanitizer/asan
4 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -932,7 +932,8 @@ ContextInfo::~ContextInfo() {
932
932
assert (Result == UR_RESULT_SUCCESS);
933
933
934
934
// check memory leaks
935
- if (getAsanInterceptor ()->isNormalExit ()) {
935
+ if (getAsanInterceptor ()->getOptions ().DetectLeaks &&
936
+ getAsanInterceptor ()->isNormalExit ()) {
936
937
std::vector<AllocationIterator> AllocInfos =
937
938
getAsanInterceptor ()->findAllocInfoByContext (Handle );
938
939
for (const auto &It : AllocInfos) {
Original file line number Diff line number Diff line change @@ -310,6 +310,8 @@ class AsanInterceptor {
310
310
ur_result_t registerSpirKernels (ur_program_handle_t Program);
311
311
312
312
private:
313
+ // m_Options may be used in other places, place it at the top
314
+ AsanOptions m_Options;
313
315
std::unordered_map<ur_context_handle_t , std::shared_ptr<ContextInfo>>
314
316
m_ContextMap;
315
317
ur_shared_mutex m_ContextMapMutex;
@@ -335,8 +337,6 @@ class AsanInterceptor {
335
337
336
338
std::unique_ptr<Quarantine> m_Quarantine;
337
339
338
- AsanOptions m_Options;
339
-
340
340
std::unordered_set<ur_adapter_handle_t > m_Adapters;
341
341
ur_shared_mutex m_AdaptersMutex;
342
342
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ AsanOptions::AsanOptions() {
88
88
SetBoolOption (" detect_locals" , DetectLocals);
89
89
SetBoolOption (" detect_privates" , DetectPrivates);
90
90
SetBoolOption (" print_stats" , PrintStats);
91
+ SetBoolOption (" detect_leaks" , DetectLeaks);
91
92
92
93
auto KV = OptionsEnvMap->find (" quarantine_size_mb" );
93
94
if (KV != OptionsEnvMap->end ()) {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ struct AsanOptions {
26
26
bool DetectPrivates = true ;
27
27
bool PrintStats = false ;
28
28
bool DetectKernelArguments = true ;
29
+ bool DetectLeaks = true ;
29
30
30
31
explicit AsanOptions ();
31
32
};
You can’t perform that action at this time.
0 commit comments