C-raii as new system allocator for Haiku

c-raii uses Resource Acquisition Is Initialization or RAII, it is MIT licensed, it can be new system allocator for Haiku, fixing this ticket: #13554 (Switch system allocator) – Haiku

“An robust high-level Defer, RAII implementation for C89, automatic memory safety, smarty!”

Links for reference about Resource Acquisition Is Initialization or RAII:

https://en.cppreference.com/w/cpp/language/raii

Apparantly, the allocator used in this is rpmalloc, which was tried before, but it was reverted because it caused too many problems back then, IIRC.

The rest of this is about a programming paradigm and has nothing to do with an allocator implementation (malloc, free, etc.).

2 Likes

It is about RAII, something that has been available in C++ since the invention of the language (it is just a complicated way to say there are destructors, and they are called when the objects are deleted). Since Haiku uses C++, we don’t need to reimplement this in C.

Yes, it caused applications to run out of memory more quickly than with the current allocator, especially on 32 bit systems. And that was after we had the developers fix various other problems with it.

It is a fork of rpmalloc with customizations and new implementations, it is not actually code implemented in Haiku.

It uses a customized part of rpmalloc and other parts implemented with RAII. The code has major differences from the original rpmalloc, it is focused on several architectures and can be compiled on simple and old compilers.

Do the problems of the original rpmalloc version continue in this fork?