File tree Expand file tree Collapse file tree 4 files changed +6
-3
lines changed
source/loader/layers/sanitizer/asan Expand file tree Collapse file tree 4 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -932,7 +932,8 @@ ContextInfo::~ContextInfo() {
932932 assert (Result == UR_RESULT_SUCCESS);
933933
934934 // check memory leaks
935- if (getAsanInterceptor ()->isNormalExit ()) {
935+ if (getAsanInterceptor ()->getOptions ().DetectLeaks &&
936+ getAsanInterceptor ()->isNormalExit ()) {
936937 std::vector<AllocationIterator> AllocInfos =
937938 getAsanInterceptor ()->findAllocInfoByContext (Handle);
938939 for (const auto &It : AllocInfos) {
Original file line number Diff line number Diff line change @@ -310,6 +310,8 @@ class AsanInterceptor {
310310 ur_result_t registerSpirKernels (ur_program_handle_t Program);
311311
312312 private:
313+ // m_Options may be used in other places, place it at the top
314+ AsanOptions m_Options;
313315 std::unordered_map<ur_context_handle_t , std::shared_ptr<ContextInfo>>
314316 m_ContextMap;
315317 ur_shared_mutex m_ContextMapMutex;
@@ -335,8 +337,6 @@ class AsanInterceptor {
335337
336338 std::unique_ptr<Quarantine> m_Quarantine;
337339
338- AsanOptions m_Options;
339-
340340 std::unordered_set<ur_adapter_handle_t > m_Adapters;
341341 ur_shared_mutex m_AdaptersMutex;
342342
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ AsanOptions::AsanOptions() {
8888 SetBoolOption (" detect_locals" , DetectLocals);
8989 SetBoolOption (" detect_privates" , DetectPrivates);
9090 SetBoolOption (" print_stats" , PrintStats);
91+ SetBoolOption (" detect_leaks" , DetectLeaks);
9192
9293 auto KV = OptionsEnvMap->find (" quarantine_size_mb" );
9394 if (KV != OptionsEnvMap->end ()) {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ struct AsanOptions {
2626 bool DetectPrivates = true ;
2727 bool PrintStats = false ;
2828 bool DetectKernelArguments = true ;
29+ bool DetectLeaks = true ;
2930
3031 explicit AsanOptions ();
3132};
You can’t perform that action at this time.
0 commit comments