Trace-Based Memory Aliasing Across Program Versions

Murali Krishna Ramanathan, Suresh Jagannathan, Ananth GramaFASE 2006 · DOI

Introduction

Software evolution is a continuous process where developers modify code to add features, optimize performance, or fix bugs. A critical challenge in this evolution is validating that changes do not introduce regressions or unintended side effects. Impact analysis—the task of identifying parts of a program affected by a specific code change—is often hindered by "memory aliasing across versions." When code is restructured, variables may be renamed, moved from scalars to arrays, or shifted in memory addresses, making it difficult for traditional tools to correlate program state between Version A and Version B.

Researchers at Purdue University have developed a probabilistic technique to bridge this gap. By treating program execution traces as biological sequences and borrowing models from bioinformatics, they can accurately map how memory locations evolve even under significant code restructuring.

The Trace-Based Alignment Framework

The proposed system treats program execution like a biological sequence, focusing on the behavioral identity of memory locations rather than their literal addresses. The high-level workflow is depicted in the following architecture diagram:

The system architecture for trace-based memory aliasing analysis, showing the pipeline from binary instrumentation to impact analysis.

The process begins with dynamic binary instrumentation using the PIN tool to record sequences of memory operations (operation type and value). By initially ignoring raw addresses, the system performs an initial alignment using Levenshtein distance to find commonalities in the execution flow.

Probabilistic Mapping via Log-Odds Ratios

The core innovation of this research is the probabilistic mapping of memory locations. Borrowing the concept of Point Accepted Mutation (PAM) matrices from bioinformatics—originally used to track amino acid mutations—the authors calculate a "log-odds ratio." This ratio determines the likelihood that a memory location $i$ in the old version corresponds to location $j$ in the new version based on how frequently they align during the value-based matching phase.

Probabilistic mapping matrix illustrating how log-odds ratios are used to determine the likelihood of memory location correspondence.

As shown in the matrix above, higher scores indicate a stronger correlation. This allows the tool to identify complex mappings, such as a single variable in an older version being expanded into multiple array elements in a newer release. Once these aliases are identified, the system re-runs the alignment with high precision.

Evaluation and Key Insights

The framework was evaluated using several well-known open-source C packages, including bzip2, gawk, htmldoc, and wget. The study yielded several key insights:

  • The 90/10 Rule: In most benchmarks, approximately 90% of memory locations have a simple one-to-one correspondence. The remaining 10% involve complex structural changes where this probabilistic approach provides the most value.
  • Improved Precision: By correctly identifying that a change in memory address does not necessarily imply a change in program logic, the tool significantly reduced "noise" in the impact sets generated during testing.
  • Value-Centric Identity: The research suggests that the behavior of a memory location (the values it holds and the timing of those values) is a far more reliable indicator of identity across versions than variable names or addresses.

Conclusion and Future Work

By viewing software evolution through the lens of genetic mutation, this research provides a robust methodology for tracking program state across versions. While dynamic instrumentation introduces a performance overhead (e.g., increasing analysis time for bzip2 from roughly 16 minutes to 52 minutes), the gain in analysis precision is vital for offline validation workflows. Future work aims to extend this technique to heap-centric languages like Java and to optimize the instrumentation process to reduce the performance penalty.

Summary updated

BibTeX
@inproceedings{ramanathan2006trace,
  author = {Murali Krishna Ramanathan and Suresh Jagannathan and Ananth Grama},
  title = {{Trace-Based Memory Aliasing Across Program Versions}},
  booktitle = {FASE},
  year = {2006},
  doi = {10.1007/11693017\_29},
}
Figure