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() {
837
837
getContext ()->urDdiTable .Context .pfnRelease (Handle);
838
838
assert (Result == UR_RESULT_SUCCESS);
839
839
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
+ }
847
849
}
848
850
}
849
851
}
Original file line number Diff line number Diff line change @@ -85,6 +85,7 @@ AsanOptions::AsanOptions() {
85
85
SetBoolOption (" detect_locals" , DetectLocals);
86
86
SetBoolOption (" detect_privates" , DetectPrivates);
87
87
SetBoolOption (" print_stats" , PrintStats);
88
+ SetBoolOption (" detect_leaks" , DetectLeaks);
88
89
89
90
auto KV = OptionsEnvMap->find (" quarantine_size_mb" );
90
91
if (KV != OptionsEnvMap->end ()) {
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ struct AsanOptions {
25
25
bool DetectPrivates = true ;
26
26
bool PrintStats = false ;
27
27
bool DetectKernelArguments = true ;
28
+ bool DetectLeaks = true ;
28
29
29
30
explicit AsanOptions ();
30
31
};
You can’t perform that action at this time.
0 commit comments