How to use D without the GC ?

DrDread DrDread at cheese.com
Wed Jun 12 09:44:05 UTC 2024


On Tuesday, 11 June 2024 at 17:15:07 UTC, Vinod K Chandran wrote:
> On Tuesday, 11 June 2024 at 16:54:44 UTC, Steven Schveighoffer 
> wrote:
>>
>>
>> I would instead ask the reason for wanting to write D code 
>> without the GC.
>>
>> -Steve
>
> Hi Steve,
> Two reasons.
> 1. I am writting a dll to use in Python. So I am assuming that 
> manual memory management is better for this project. It will 
> give finer control to me.
> 2. To squeeze out the last bit of performance from D.

the GC only runs on allocation. if you want to squeeze out the 
last bit of performance, you should preallocate all bufferes 
anyway, and GC vs no GC doesn't matter.
also just slap @nogc on your main function to avoid accidential 
allocations.


More information about the Digitalmars-d-learn mailing list