On 1/31/20 2:14 AM, 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
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 could use RefCounted to build a struct that then is sendable with
the data you need. RefCounted allocates using C malloc, not the GC.
It might actually be reasonable to modify std.concurrency to use
RefCounted instead of GC memory (i.e. it needs to be a specialized Variant).