Registering-unregistering threads
user1234
user1234 at 12.de
Mon Aug 2 06:52:02 UTC 2021
On Friday, 30 July 2021 at 23:48:41 UTC, solidstate1991 wrote:
> I'm doing some audio-related work, and one thing I need is to
> unregister from (and maybe later temporarily re-register to)
> the GC, since it would cause some issues,
GC + audio is only a problem if its pauses (e.g in the audio
thread) are longer than the time required to create a buffer (as
obviously computer audio is **not real-time**).
Let's say you have 3 msecs GC pause, 12 msecs to create a buffer,
if the driver latency is of 22 msecs then the rendering will not
be affected, e.g when the driver reclaims a buffer it is ready
and no perceptible crackling occurs.
> and it would be nice if I still could use the GC during disk
> operations, etc.
>
> Info on it is quite scarce and a bit confusing. If I unregister
> from the RT, will that mean it'll be GC independent, or will
> have other consequences too?
Mixin C heap memory and GC memory is a known source of issues
because of GC roots.
A simpler solution is to continue using the GC memory (e.g `new`)
but control manually when it runs using `GC.enable`, `GC.disable`
and `GC.collect`, `GC.minimize`.
More information about the Digitalmars-d-learn
mailing list