@nogc destroy

evilrat evilrat666 at gmail.com
Sat Jan 15 08:44:30 UTC 2022


On Saturday, 15 January 2022 at 05:03:20 UTC, Elronnd wrote:
> On Friday, 14 January 2022 at 23:28:44 UTC, Adam Ruppe wrote:
>> Currently calling .destroy(class_object) fails the @nogc tests.
>
> Practical Q: how many people are using classes without gc?  And 
> how many of those people are actually using @nogc vs just not 
> linking the gc in the first place?

I've used @nogc as simple diagnostic, shows where it can allocate 
inside hot paths, other than that - never.
But now there is also -vgc flag for this task which is less 
intrusive but also less "precise".

One can allocate classes without GC and handle its lifetime 
manually, there is actually whole class of tasks where one might 
need it (high-frequency trading, realtime software such as 
machinery controllers, game engines and games to some extent...).

There is also extern(C++) classes that can be used when you are 
limited to BetterC (for example WASM) or other low level software 
or even highly specific low level C++ interoperability where 
regular extern(C++) class just doesn't works (diamond problem, 
etc...).


More information about the Digitalmars-d mailing list