Per thread heap, GC, etc.
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Fri May 14 15:21:30 UTC 2021
On Friday, 14 May 2021 at 15:00:20 UTC, Markk wrote:
> When the thread terminates (or drops out of the defining
> scope), the whole memory can be freed as a whole. The discussed
> language guarantees would make sure you have nothing mixed and
> dangling. If GC was your set Allocator, no final collection is
> needed, as you equally proposed ;-).
Yes, the problem is that spinning up a new thread is costly, and
in order to get the benefits of "no final collection" the thread
should be short lived.
So, that is where tasks come to the rescue. If you can split the
work-load on many short-lived tasks then it can execute on many
threads at the same time and still not cause any collection cycle.
Of course, if you allow suspension of execution then you need to
deal with saving the stack somehow or implement stackless
coroutines (or something similar).
Anyway, I am happy to see that we are on the same page in
general, let's keep the ideas on this flowing :-). Then maybe we
can come up with something nice over time.
Cheers,
Ola.
More information about the Digitalmars-d
mailing list