compile time garbage collection
weaselcat via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 3 01:22:30 PDT 2015
On Sunday, 3 May 2015 at 08:02:37 UTC, Ola Fosheim Grøstad wrote:
> On Sunday, 3 May 2015 at 04:46:52 UTC, ketmar wrote:
>> i don't thing that such pass in general worth the efforts. D
>> programmers
>> tend to use structures for local and short-lived objects. if i
>> did `new`,
>> chances are that i really want it on heap, and it will not be
>> optimisable
>
> This is where one have to decide whether to make a low/system
> level language with programmer control or a high level language
> with compiler control. If you have GC by default, then it
> makes a lot of sense to not even have a stack conceptually and
> do explicit allocations and stack allocation as an optimization.
>
> But yeah, a system level language should allow threads to be
> terminated which would prevent destructors from being called,
> and since GC call destructors on another thread it will change
> program behaviour to turn GC allocations into stack allocations
> in general...
>
there's no guarantee GC allocated memory will _ever_ have their
destructor ran, it's part of the spec.
>The garbage collector is not guaranteed to run the destructor
>for all unreferenced objects.
More information about the Digitalmars-d
mailing list