File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed
source/loader/layers/sanitizer Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -837,13 +837,15 @@ ContextInfo::~ContextInfo() {
837837 getContext ()->urDdiTable .Context .pfnRelease (Handle);
838838 assert (Result == UR_RESULT_SUCCESS);
839839
840- // check memory leaks
841- std::vector<AllocationIterator> AllocInfos =
842- getContext ()->interceptor ->findAllocInfoByContext (Handle);
843- for (const auto &It : AllocInfos) {
844- const auto &[_, AI] = *It;
845- if (!AI->IsReleased ) {
846- ReportMemoryLeak (AI);
840+ if (getOptions ().DetectLeaks ) {
841+ // check memory leaks
842+ std::vector<AllocationIterator> AllocInfos =
843+ getContext ()->interceptor ->findAllocInfoByContext (Handle);
844+ for (const auto &It : AllocInfos) {
845+ const auto &[_, AI] = *It;
846+ if (!AI->IsReleased ) {
847+ ReportMemoryLeak (AI);
848+ }
847849 }
848850 }
849851}
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ AsanOptions::AsanOptions() {
8585 SetBoolOption (" detect_locals" , DetectLocals);
8686 SetBoolOption (" detect_privates" , DetectPrivates);
8787 SetBoolOption (" print_stats" , PrintStats);
88+ SetBoolOption (" detect_leaks" , DetectLeaks);
8889
8990 auto KV = OptionsEnvMap->find (" quarantine_size_mb" );
9091 if (KV != OptionsEnvMap->end ()) {
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ struct AsanOptions {
2525 bool DetectPrivates = true ;
2626 bool PrintStats = false ;
2727 bool DetectKernelArguments = true ;
28+ bool DetectLeaks = true ;
2829
2930 explicit AsanOptions ();
3031};
You can’t perform that action at this time.
0 commit comments