Adding Support for Reference Counting in the D Programming Language

R˘azvan Nit¸u, Eduard St˘aniloiu, R˘azvan Deaconescu, R˘azvan Rughinis¸

2022

Abstract

As more and more software products are developed daily, the security risks imposed by the growing code bases increase. To help mitigate the risk, memory safe systems programming languages, such as D and Rust, are increasingly adopted by developers. The D programming language uses, by default, a garbage collector for memory management. If the performance of a program is bottle-necked by it, or a system is resource constrained, as is the case for the ever-growing Internet of Things devices, the user has the option opt out and employ a custom allocation strategy. However, in this situation, the programmer needs to manually manage memory - a complex and error-prone task. An alternative is represented by a middle ground solution in the form of automatic reference counting. This strategy offers simplicity and performance for a small cost in expressiveness. However, due to the transitive nature of type qualifiers in D and purity-based optimizations, it is impossible to implement a library solution. In this paper, we present the problems introduced by transitive type qualifiers to reference counting and we propose the addition of a new storage class for members of aggregate declarations that breaks the transitivity of type qualifiers. We present our design and show that it can be used to implement a generic automatic reference counting mechanism without disabling purity based optimizations.

Download


Paper Citation


in Harvard Style

Nit¸u R., St˘aniloiu E., Deaconescu R. and Rughinis¸ R. (2022). Adding Support for Reference Counting in the D Programming Language. In Proceedings of the 17th International Conference on Software Technologies - Volume 1: ICSOFT, ISBN 978-989-758-588-3, pages 299-306. DOI: 10.5220/0011290000003266


in Bibtex Style

@conference{icsoft22,
author={R˘azvan Nit¸u and Eduard St˘aniloiu and R˘azvan Deaconescu and R˘azvan Rughinis¸},
title={Adding Support for Reference Counting in the D Programming Language},
booktitle={Proceedings of the 17th International Conference on Software Technologies - Volume 1: ICSOFT,},
year={2022},
pages={299-306},
publisher={SciTePress},
organization={INSTICC},
doi={10.5220/0011290000003266},
isbn={978-989-758-588-3},
}


in EndNote Style

TY - CONF

JO - Proceedings of the 17th International Conference on Software Technologies - Volume 1: ICSOFT,
TI - Adding Support for Reference Counting in the D Programming Language
SN - 978-989-758-588-3
AU - Nit¸u R.
AU - St˘aniloiu E.
AU - Deaconescu R.
AU - Rughinis¸ R.
PY - 2022
SP - 299
EP - 306
DO - 10.5220/0011290000003266