International Journal of Computer Applications |
Foundation of Computer Science (FCS), NY, USA |
Volume 183 - Number 22 |
Year of Publication: 2021 |
Authors: Elaf Alhazmi, Abdulwahab Aljubairy, Ahoud Alhazmi |
10.5120/ijca2021921572 |
Elaf Alhazmi, Abdulwahab Aljubairy, Ahoud Alhazmi . Memory Management via Ownership Concept Rust and Swift: Experimental Study. International Journal of Computer Applications. 183, 22 ( Aug 2021), 1-10. DOI=10.5120/ijca2021921572
One of the most important features to help facilitate reliable design in a programming language is memory management design. There are two wide-spread approaches: manual and automatic memory management, known as garbage collection (GC). Recently, a third approach which is ownership design has been fully adapted in new modern programming languages such as Rust and Swift. Rust uses ownership to eliminate high degree memory problems such as memory leak, dangling pointer, and use after free. Rust follows deterministic syntax-driven memory management depending on static ownership rules implemented and enforced by the rustc compiler. Swift also implements ownership concept in automatic reference counting (ARC). Though the ownership concept is adapted in Swift, it is not a memory-safe language because of the possibility of strong reference cycles. In this paper, we will illustrate the fundamental of ownership and the consequences of memory safety guarantees and issues related to Rust and Swift.We also conducted an experiment to compare the elapsed time binary tree allocation and deallocation in five programming languages C, C++, Java, Swift and Rust.