Constant GC allocations when sending large messages to threads?

bauss jj_1337 at live.dk
Fri Jan 31 08:46:51 UTC 2020


On Friday, 31 January 2020 at 07:14:30 UTC, cc wrote:
> On Wednesday, 29 January 2020 at 21:10:53 UTC, Steven 
> Schveighoffer wrote:
>> I'm pretty sure std.concurrency uses Variant to pass message 
>> data, which boxes when it gets over a certain size. You are 
>> probably crossing that threshold.
>>
>> The allocations should level out eventually when the GC starts 
>> collecting them.
>>
>> -Steve
>
> Is there a way to pre-allocate a buffer or something to be 
> used?  Ideally I'd like to avoid too many garbage collections 
> happening, in my application these thread messages happen 
> almost every frame and are quickly adding up to 100s of 
> kilobytes in allocations every few seconds.

You can just allocate non-GC memory.


More information about the Digitalmars-d-learn mailing list