GC and realtime threads.

Hasan Aljudy hasan.aljudy at gmail.com
Wed Jul 12 23:16:04 PDT 2006



chrisk wrote:
> I'm interested in trying D for writing some audio fx plugins. Basicly the 
> plugin would be a dll with 2 threads, a GUI and an Audio thread. Is it 
> posible to prevent the GC from running during the audio thread? Can the 
> audio thread stop the CG? As the dll will be loaded into a host application 
> does that mean the GC will halt the all dll and application threads while it 
> runs?
> 
> thanks,
> 
> chris 
> 
> 

Well, you could disable the GC, but I think you lose a lot of D Power by 
doing that.
You can manually delete objects/arrays when you know you're not going to 
use them anymore, even when the GC is enabled.

I'm not familiar at all with audio programming, but I think you can 
design your code such that there is always very little garbage, while 
leaving the GC running in the background, to clean any garbage you might 
have forgotten to clean manually.
Maybe calling std.gc.fullCollect() everynow and then (while there is 
still little garbage) may help in this case.

However, all of that is a bunch of wild guesses off the top of my head. 
I haven't tested any of it and I don't know if it eliminates any pauses 
caused by the GC or not.



More information about the Digitalmars-d-learn mailing list