Welcome

I observe that while using xmms with ALSA output plugin
and alsa-20040120 compiled lib we get shared memory usage growing.
Any opening of new sound source (sound file etc.) adds a new shm segment while old segments stay in memory until xmms exits.
Sometimes they stay even after application closing and must be removed manually.
I am sending a small patch which should remove this behaviour.


Regards
--
Adam Tla/lka      mailto:[EMAIL PROTECTED]    ^v^ ^v^ ^v^
Computer Center,  Technical University of Gdansk, Poland
PGP public key:   finger [EMAIL PROTECTED]
--- alsa-20040120/alsa-lib/src/pcm/pcm_mmap_old.c       2004-01-20 11:03:28.000000000 
+0100
+++ alsa-20040120/alsa-lib/src/pcm/pcm_mmap.c   2004-01-20 13:04:03.000000000 +0100
@@ -462,11 +462,16 @@
                        if (i->u.shm.area) {
                                snd_shm_area_destroy(i->u.shm.area);
                                i->u.shm.area = NULL;
-                       } else {
-                               err = shmdt(i->addr);
-                               if (err < 0) {
-                                       SYSERR("shmdt failed");
-                                       return -errno;
+                               if (pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
+                                   pcm->access == SND_PCM_ACCESS_RW_INTERLEAVED) {
+                                       unsigned int c1;
+                                       for (c1 = c + 1; c1 < pcm->channels; c1++) {
+                                               snd_pcm_channel_info_t *i1 = 
&pcm->mmap_channels[c1];
+                                               if (i1->u.shm.area) {
+                                                       
snd_shm_area_destroy(i1->u.shm.area);
+                                                       i1->u.shm.area = NULL;
+                                               }
+                                       }
                                }
                        }
                        break;

Reply via email to