Re: How to use D without the GC ?
Lance Bachmeier kirjoitti 13.6.2024 klo 1.32: Why would it be different from calling malloc and free manually? I guess I'm not understanding, because you put the same calls to malloc and free that you'd otherwise be doing inside this and ~this. Because with `SafeRefCounted`, you have to decide the size of your allocations at compile time, meaning you need to do a varying number of `malloc`s and `free`s to vary the size of your allocation at runtime. Even if you were to use templates to vary the type of `SafeRefCounted` object based on size of your allocation, the spec puts an upper bound of 16MiB to size of a static array. So for example, if you have a program that sometimes needs 600Mib and sometimes needs 1100MiB, you can in any case allocate all that in one go with one `malloc` or one `new`, but you'll need at least 38/59 `SafeRefCounted` static arrays, and therefore `malloc`s, to accomplish the same.
Re: How to use D without the GC ?
Dukc kirjoitti 13.6.2024 klo 10.18: So for example, if you have a program that sometimes needs 600Mib and sometimes needs 1100MiB, you can in any case allocate all that in one go with one `malloc` or one `new`, but you'll need at least 38/59 `SafeRefCounted` static arrays, and therefore `malloc`s, to accomplish the same. Now granted, 16MiB (or even smaller amounts, like 256 KiB) sounds big enough that it probably isn't making a difference since it's a long way into multiples of page size anyway. But I'm not sure.
Re: Feedback request from production of the usage of DWT
On Thursday, 13 June 2024 at 06:59:49 UTC, Menjanahary R. R. wrote: How important is its adoption? Is GUI App in D frequent? There are quite few D GUI projects we are aware of, Tilix being one of the popular ones. I have few personal projects that are based, like Tilix, on GtkD (https://gtkd.org). I never tried DWT.
Re: Feedback request from production of the usage of DWT
On Thursday, 13 June 2024 at 06:59:49 UTC, Menjanahary R. R. wrote: How important is its adoption? Is GUI App in D frequent? I am not sure if this is a known usage scenario with DWT. Once I wanted to use DWT. Since it is a port to SWT of Java. You can use existing GUI designers of SWT. They generate Java SWT classes. I had to spend a minimum effort to convert the generated Java class into dlang. here it is: https://github.com/aferust/testds5
Re: How to use D without the GC ?
On Thursday, 13 June 2024 at 07:18:48 UTC, Dukc wrote: Lance Bachmeier kirjoitti 13.6.2024 klo 1.32: Why would it be different from calling malloc and free manually? I guess I'm not understanding, because you put the same calls to malloc and free that you'd otherwise be doing inside this and ~this. Because with `SafeRefCounted`, you have to decide the size of your allocations at compile time, meaning you need to do a varying number of `malloc`s and `free`s to vary the size of your allocation at runtime. Even if you were to use templates to vary the type of `SafeRefCounted` object based on size of your allocation, the spec puts an upper bound of 16MiB to size of a static array. We must be talking about different things. You could, for instance, call a function in a C library to allocate memory at runtime. That function returns a pointer and you pass it to SafeRefCounted to ensure it gets freed. Nothing is known about the allocation at compile time. This is in fact my primary use case - allocating an opaque struct allocated by a C library, and not wanting to concern myself with freeing it when I'm done with it.