digitalmars.D.learn - New in D
- Jakepys (7/7) Jul 14 While researching programming languages, I tried Zig, Rust, C++,
- Mindy (0xEAB) (21/22) Jul 14 The GC is semi-opt-out.
- Mike Parker (6/14) Jul 14 I suggest you watch this DConf talk by Lewis Nicolle about the 3D
- FinalEvilution (25/33) Jul 15 Welcome!
- =?UTF-8?Q?Ali_=C3=87ehreli?= (7/10) Jul 15 It took me a while to discover about myself that not feature lists but
While researching programming languages, I tried Zig, Rust, C++, and Go, but none of them seemed fun. Then, at a conference, I suddenly discovered D; I hadn't heard of it before, and now I find it beautiful and very entertaining to learn. I'm coming from C and I'd like to know what I can do with it, especially regarding memory management and garbage collection, although I don't think it's enabled by default. Thanks.
Jul 14
On Wednesday, 15 July 2026 at 01:54:28 UTC, Jakepys wrote:although I don't think it's enabled by default.The GC is semi-opt-out. It only ever collects memory when you ask it to allocate memory for you or you call its `collect()` function. It also features a `disable()` function, that bumps the internal counter and prevents collections from occurring. The counterpart is `enable()` which counterbumps the counter. The counter allows you to focus on your code without worrying about re-enabling the collection mechanism early. You can also register your own memory segments with the GC, so that the GC can scan those for pointers into GC-allocated memory. Here's the corresponding library documentation: <https://dlang.org/library/core/memory/gc.html> As you might be able to tell, the GC is part of Druntime. If you choose to opt out of using the runtime (e.g. by passing `-betterC` to the compiler), you'll not have it available. Further information on the GC's inner workings can be found here: <https://dlang.org/library/core/memory.html> Last but not least, if you don't mind the slop “cartoon” graphic and messed up document layout, you might find the text of this spec page interesting: <https://dlang.org/spec/garbage.html>
Jul 14
On Wednesday, 15 July 2026 at 01:54:28 UTC, Jakepys wrote:While researching programming languages, I tried Zig, Rust, C++, and Go, but none of them seemed fun. Then, at a conference, I suddenly discovered D; I hadn't heard of it before, and now I find it beautiful and very entertaining to learn. I'm coming from C and I'd like to know what I can do with it, especially regarding memory management and garbage collection, although I don't think it's enabled by default. Thanks.I suggest you watch this DConf talk by Lewis Nicolle about the 3D engine and game he developed in D and see what he had to say about memory management and garbage collection: https://youtu.be/P6M_psWzo60 The whole talk is a great example of what you can do with D.
Jul 14
On Wednesday, 15 July 2026 at 01:54:28 UTC, Jakepys wrote:While researching programming languages, I tried Zig, Rust, C++, and Go, but none of them seemed fun. Then, at a conference, I suddenly discovered D; I hadn't heard of it before, and now I find it beautiful and very entertaining to learn. I'm coming from C and I'd like to know what I can do with it, especially regarding memory management and garbage collection, although I don't think it's enabled by default. Thanks.Welcome! This isn't related to memory management, but seeing as you're coming from C you may find D's [ImportC](https://dlang.org/spec/importc.html) very interesting if you don't already know about it. It allows for easy usage of C's library's in D. I'm using it for accessing the turbojpeg and dbus library's myself. For example here's my jpeg.c file. ```C #include <stdio.h> #include <stdlib.h> #include <string.h> #include "jpeglib.h" ``` And on the D side i just import it like so `import jpeg;` Compile it with. `dmd main.d -L-ljpeg` No function declarations in it or the #include's so it doesn't even need to be added to the build command, just linked. (I'm on linux building by hand with Make. If you're using DUB add [libs](https://dub.pm/dub-reference/build_settings/#libs) to the build file.) And just like that i can access all the jpeg functions without any third-party wrappers. It's pretty great.
Jul 15
On 7/14/26 6:54 PM, Jakepys wrote:none of them seemed fun.It took me a while to discover about myself that not feature lists but soft qualities like its community make programming languages (and other things) attractive.Then, at a conference, I suddenly discovered D;What was the context? Was it mentioned during a presentation or by an attendee? Ali
Jul 15









Mindy (0xEAB) <desisma heidel.beer> 