digitalmars.D.announce - NuMem - safe(r) nogc memory managment
- Luna (24/24) Dec 30 2023 NuMem 0.5.4 has been released, numem is a new library I am
- Guillaume Piolat (4/7) Dec 30 2023 Indeed with numem you can have a relatively "C++11" experience
- ryuukk_ (2/2) Dec 30 2023 Nice, thanks for sharing, it'll be very useful for the C++
- ryuukk_ (5/7) Dec 30 2023 I'd be happy to help
- Guillaume Piolat (3/7) Dec 30 2023 FWIW it's possible to do a generic one with one function pointer:
- IGotD- (4/12) Dec 30 2023 Yes, but first we can replace all the data structures in druntime
- Sergey (4/5) Jan 02 Any meaningful comparison with another similar library will be
- Guillaume Piolat (10/15) Jan 03 I'm not familiar with automem, and I'm not numem primary author.
NuMem 0.5.4 has been released, numem is a new library I am developing with contributions from Auburn Sounds/p0nce. It's meant to provide safer ways of writing nogc code, which is sometimes neccesary when the D garbage collector would be an unoptimal choice. NuMem currently features: * C++ style smart pointers (unique_ptr, shared_ptr, weak_ptr) * C++ style vector type (with support for moving unique_ptr's in!) * Alternative for new and destroy; `nogc_new` and `nogc_delete`. * A string alternative built on the vector implementation * Automatic null-pointer handling, for easy passing of strings to C. * A `minimal_rt` mode meant for environments where only a tiny subset of the D runtime is present, with custom handling of class destruction that doesn't use TypeInfo. * Eg. the port of D I'm making for the SEGA Dreamcast. We plan to add more memory management utilities, thereby making writing completely GC-less D code a lot more user-friendly. You can find the package here https://code.dlang.org/packages/numem Additionally, the `yxml` package uses numem's smart pointers and strings. https://code.dlang.org/packages/yxml
Dec 30 2023
On Saturday, 30 December 2023 at 15:17:36 UTC, Luna wrote:* C++ style smart pointers (unique_ptr, shared_ptr, weak_ptr) * C++ style vector type (with support for moving unique_ptr's in!)Indeed with numem you can have a relatively "C++11" experience with scoped ownership, which we intend to make use of because without GC it's easy to be plagued by leaks in user code.
Dec 30 2023
Nice, thanks for sharing, it'll be very useful for the C++ developers who want to give D a try
Dec 30 2023
We plan to add more memory management utilities, thereby making writing completely GC-less D code a lot more user-friendly.I'd be happy to help What D really is missing _right now_, and will hopefully get _before_ phobosv3 is a good and minimalistic Allocator API, i modeled mine around zig's, no RAII, just a simple struct with 3 function ptr
Dec 30 2023
On Saturday, 30 December 2023 at 16:36:38 UTC, ryuukk_ wrote:What D really is missing _right now_, and will hopefully get _before_ phobosv3 is a good and minimalistic Allocator API, i modeled mine around zig's, no RAII, just a simple struct with 3 function ptrFWIW it's possible to do a generic one with one function pointer: https://www.lua.org/manual/5.4/manual.html#lua_Alloc
Dec 30 2023
On Saturday, 30 December 2023 at 16:36:38 UTC, ryuukk_ wrote:Yes, but first we can replace all the data structures in druntime to use non GC versions. I don't think there are that many of them. The non GC dynamic array would be a good fit here.We plan to add more memory management utilities, thereby making writing completely GC-less D code a lot more user-friendly.I'd be happy to help What D really is missing _right now_, and will hopefully get _before_ phobosv3 is a good and minimalistic Allocator API, i modeled mine around zig's, no RAII, just a simple struct with 3 function ptr
Dec 30 2023
On Saturday, 30 December 2023 at 15:17:36 UTC, Luna wrote:NuMem 0.5.4 has been released, numem is a new libraryAny meaningful comparison with another similar library will be highly appreciated https://code.dlang.org/packages/automem
Jan 02
On Tuesday, 2 January 2024 at 10:30:52 UTC, Sergey wrote:On Saturday, 30 December 2023 at 15:17:36 UTC, Luna wrote:I'm not familiar with automem, and I'm not numem primary author. Goals seems very similar and from a cursory reading: - automem is much further along on many points such as: attribute forwarding, nogc, safe, DIP1000, allocator support, ranges, support for GC roots, and exists since 6 years. - numem is designed to allow C++ programmers to feel at ease, with a bit less runtime use maybe. Containers own their elements, like C++ containers (not sure how it is in automem). We plan a std::map-like.NuMem 0.5.4 has been released, numem is a new libraryAny meaningful comparison with another similar library will be highly appreciated https://code.dlang.org/packages/automem
Jan 03