All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Tla/lka <atlka@pg.gda.pl>
To: alsa-devel@lists.sourceforge.net
Subject: Small patch for alsa-lib
Date: Tue, 20 Jan 2004 13:32:28 +0100	[thread overview]
Message-ID: <400D1FDC.9040804@pg.gda.pl> (raw)

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

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:atlka@pg.gda.pl    ^v^ ^v^ ^v^
Computer Center,  Technical University of Gdansk, Poland
PGP public key:   finger atlka@sunrise.pg.gda.pl

[-- Attachment #2: alsa-20040120.patch --]
[-- Type: text/plain, Size: 793 bytes --]

--- 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	other threads:[~2004-01-20 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-20 12:32 Adam Tla/lka [this message]
2004-01-20 12:45 ` Small patch for alsa-lib Jaroslav Kysela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=400D1FDC.9040804@pg.gda.pl \
    --to=atlka@pg.gda.pl \
    --cc=alsa-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.