Note that there are some explanatory texts on larger screens.

plurals
  1. POIn which cases using language with GC allows audio playback without dropouts?
    primarykey
    data
    text
    <p>As far as I know, using a language with Garbage Collection means there will be time intervals, inside which entire application is stopped. But I'm curious about the scope of this stops.</p> <p>For example, there are <code>PortAudio</code> bindings for Java, and there are 2 modes of operation, which differ in control direction. In one mode you call PortAudio to put some data that it must play and in other mode PortAudio calls you (callback function) to fill its buffers with data. I am wondering, why Java bindings for PortAudio don't allow second mode (using callback). The explanation is, as can be read <a href="http://portaudio.com/docs/v19-doxydocs/classcom_1_1portaudio_1_1PortAudio.html" rel="nofollow">here</a>: <code>This Java binding does not support audio callbacks because an audio callback should never block. Calling into a Java virtual machine might block for garbage collection or synchronization. So only the blocking read/write mode is supported.</code> This implies that in other case GC should not be a problem? <em>But why?</em> I don't understand this.</p> <p>And how the situation will differ in other programming languages with GC? (especially interesting are C# and D.) What things should I take care of if I want to implement an audio player (that never ever drops out samples) in language with GC while using only 1 process? And is it possible at all?</p> <p>Previously I was participating in developing a kind of VoIP software in Java and there was serious problems with dropouts which correlated in time with GCs. But doing music player should be easier, I think, because latency is not a problem here and I can use huge buffer for audio data.</p> <h2>Update:</h2> <p>I am interested only in free and open source solutions. So, for example, using an "alternative" but non-free implementation of Java runtime is not an option for me to use. But it's interesting to know anyway.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. CONote that any answer necessarily depends on the details of the GC in question (which can vary quite a bit among JVMs and even within a single JVM). Some GCs guarantee a maximum pause time, other don't pause at all (except very briefly and rarely to copy the stack, hardly worth mentioning), while others don't give any guarantee. Some can be prevented from running by not allocating any memory, others may still run if you never allocate anything.
      singulars
      1. This table or related slice is empty.
    2. CO@delnan On HotSpot, all GC's pause and none gives a guaranteed maximum pause time. Some expend best effort towards limiting pauses. And as far as I know, none run when no allocation happens.
      singulars
    3. CO"As far as I know, using a language with Garbage Collection means there will be time intervals, inside which entire application is stopped." That assumption is wrong. You are thinking of a certain type of Garbage Collector, a 'stop-the-world' garbage collector. A concurrent garbage collector in theory doesn't stop the program at all. And there are real-time or near real-time GCs as delnan points out. @MarkoTopolnik It depends the JVM. Some JVMs do have a real-time constrain on how long a GC cycle can be.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload