I am having trouble getting Asan to pick up on heap memory not being freed.
int main() {
int* arr = new int[10];
// arr[10] = 5; // Asan will warn me about this invalid access
// Asan says nothing about the arr I did NOT free
}
I have configured Asan for Visual Studio 2022 as described here: https://learn.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170#ide-msbuild
I have tried both the Visual Studio UI version of running Asan by running the debugger and the command line version of build the executable and then running it. Neither mention the memory not being freed.
Is it not possible ot get Asan to warn about a memory leak like this?
Detecting memory leak is under consideration. You can vote on the Developer Community.