Home
Scholarly Works
Towards Reliable Memory Management for Python...
Conference

Towards Reliable Memory Management for Python Native Extensions

Abstract

Many programming languages provide a C interface as a foreign function interface (FFI) for C developers to access the language, the Python language being one of these languages. Over the years, the Python C API has grown to be a challenge for the evolution of the Python ecosystem. In this paper, we implement a new Python FFI, we call CyStck, by combining a stack and light-weight handles, to support efficient garbage collection (GC) in Python native extensions. CyStck introduces execution time overhead while copying the fewest bytes for all benchmarks across the CPython boundary compared to the CPython API and HPy respectively. We also implemented a tool to automate the migration of extensions from the CPython C API to CyStck using advanced pattern matching and static analysis, with a success rate as high as 90% in some workloads.

Authors

Nanjekye J; Bremner D; Micic A

Pagination

pp. 15-26

Publisher

Association for Computing Machinery (ACM)

Publication Date

July 17, 2023

DOI

10.1145/3605158.3605849

Name of conference

Proceedings of the 18th ACM International Workshop on Implementation, Compilation, Optimization of OO Languages, Programs and Systems
View published work (Non-McMaster Users)

Contact the Experts team