What can static analysis NOT find?
-
The use of a variable before it has been defined
-
Unreachable (dead) code
-
Memory leaks
-
Array bound violations
Static analysis can detect coding issues like undefined variables, unreachable code, and array violations by examining source code structure. However, memory leaks are runtime behavioral issues that depend on execution patterns, resource allocation timing, and object lifecycle - these cannot be determined through static code examination alone. Memory leak detection requires runtime monitoring and profiling tools.
Static analysis inspects source code without running it, so it can catch structural issues like uninitialized variable use, dead code, and array bound violations by reasoning about the code's structure. Memory leaks, however, are a runtime phenomenon tied to actual allocation and deallocation behavior over time, so they typically require dynamic analysis (running the program and observing memory usage) to detect.