Large codebases, e.g., with millions of lines of code, can have sections that are dead - sections of code that are rarely or never executed in practice. Currently, developers cannot feasibly identify dead code, especially for client applications that are server driven. In the absence of evidence that a code section is dead, developers are obliged to migrate it to higher versions of the codebase. Dead code thus accumulates over time and adds a tax on all future changes. This disclosure describes techniques to detect dead code based on the behavior patterns of client software during runtime. With user permission, stack traces are sampled and captured during runtime across a large number of devices running a given client software. Symbolicated call stacks are listed by frequency of execution to determine sections of code that are rarely or never executed. Rare or never-executed sections of code are reported to developers for further analysis to identify and remove dead code.
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.
Palmer, Edward; Vaitukaitis, Vytautas; Franco, John; and Zhang, Suki, "Detecting Dead Code Based on Captured Stack Traces", Technical Disclosure Commons, (December 19, 2021)