Код: Выделить всё
int main(int argc, char *argv[])
{
// breakpoint here: ~= 6MB
get_audio_waveform();
// breakpoint here: ~= 9MB
}
Код: Выделить всё
AVFormatContext* p_input_fmt_ctx = nullptr;
AVCodecContext* p_input_cdc_ctx = nullptr;
SwrContext* p_resampler_ctx = nullptr;
AVAudioFifo* p_audio_fifo = nullptr;
uint8_t** p_converted_input = nullptr;
uint8_t** p_converted_output = nullptr;
Код: Выделить всё
void _cleanup()
{
avformat_close_input(&p_input_fmt_ctx);
avcodec_free_context(&p_input_cdc_ctx);
swr_free(&p_resampler_ctx);
if (p_audio_fifo)
{
av_audio_fifo_reset(p_audio_fifo);
av_audio_fifo_free(p_audio_fifo);
p_audio_fifo = nullptr;
}
if (p_converted_input)
{
av_freep(&p_converted_input[0]);
free(p_converted_input);
p_converted_input = nullptr;
}
if (p_converted_output)
{
av_freep(&p_converted_output[0]);
free(p_converted_output);
p_converted_output = nullptr;
}
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... mory-leaks
Мобильная версия