stelatoris / XTronical-I2S-Audio-with-SD

7 stars 2 forks source link

BEEP : memory leak / resource never released #7

Open LabRat3K opened 2 months ago

LabRat3K commented 2 months ago

The "BEEP" function allocates a new XT_Instrument_Class instance, passes it into the Play() function and it is never disposed of once completed. After the DurationCounter for the XT_Instrument_Class::NextSample has count down to zero, the NextSample exits (with sample (0,0)), but this instrument instance remains in the playlist forever (always returning (0,0)). Eventually causing performance impacts (with each subsequent BEEP).

Two issues at hand:

  1. Instrument instance is not being removed from the PlayList once the beep is completed.
  2. Beep instance is not being deleted/freed upon completion.

(Issue is with original library, but posting this here as I was using this fork for development)