Constant GC allocations when sending large messages to threads?
Steven Schveighoffer
schveiguy at gmail.com
Wed Jan 29 21:10:53 UTC 2020
On 1/29/20 2:48 PM, cc wrote:
> Given the sample program at https://pastebin.com/u9sSNtj7
> I'm experiencing GC allocations with every call to std.concurrency.send
> when sending larger messages (e.g. multiple ulongs). These do not occur
> when sending uints in comparison, in the provided example.
>
> For example, when the ManyAllocations version is set, I see results like:
> allocations: 100 bytes: 3280
>
> When commented out, I see:
> allocations: 1 bytes: 80
>
> Is there a way to mitigate this memory usage?
>
> Using DMD32 D Compiler v2.089.1-dirty on Windows 10 x64
> cmdline: rdmd.exe -m64
>
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
More information about the Digitalmars-d-learn
mailing list