Skip to contentSkip to conversation

Memory leak in the dmix plugin?

DISCUSSION Konstantin Stepaniuk 1 participant 1 message Aug 29, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

I've found a problem with the dmix plugin. This simple test demonstrates the bug.

//--------------------
#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#include <alsa/asoundlib.h>
#include <stdio.h>
#include <stdlib.h>

#define ALSA_ERROR(e) if( (e) < 0 ) { fprintf( stderr, "%s\n", snd_strerror((e)) ); exit(-1); }

int main( void )
{
for( ;; )

  {
    snd_pcm_t           *pcm;
    snd_pcm_hw_params_t *hwparams;
    int                  err;

    err = snd_pcm_open( &pcm, "plug:dmix", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK );
    ALSA_ERROR(err);

    snd_config_update_free_global();

    err = snd_pcm_hw_params_malloc( &hwparams );
    ALSA_ERROR(err);

    err = snd_pcm_hw_params_any( pcm, hwparams );
    ALSA_ERROR(err);

    err = snd_pcm_hw_params( pcm, hwparams );
    ALSA_ERROR(err);

    snd_pcm_hw_params_free( hwparams );
    snd_pcm_close( pcm );

}

return 0;
}
//--------------------

This program causes error:
ALSA lib pcm_mmap.c:362:(snd_pcm_mmap) shmget failed: No space left on device No space left on device

alsa-lib and drivers from cvs.

Konstantin Stepaniuk

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf