[vorbis-dev] Possible fix for bug #14 (ogg123 -b memory leak)
William T. Mahan
wtm2 at duke.edu
Thu May 10 21:39:31 PDT 2001
Hi all,
Browsing through the bug database, I was able to reproduce #14. Briefly,
when I run, for example:
ogg123 -b 8000 test1.ogg test2.ogg test1.ogg [...]
where test1.ogg and test2.ogg have different bitrates or numbers of
channels (that is important), ogg123's memory usage continuously
increases as each new song is played.
I think I've tracked down the bug to the use of shared memory in the
buffer code. It appears that shmdt() needs to be called on the segment
each time the buffer is shut down. The following patch fixes the problem
for me.
Only the second call seems to be necessary, but I included the first for
completeness. Also, I'm not sure I put the calls in the optimal places,
so if someone could confirm that the fix is correct, it would be appreciated.
-- Wil
Index: buffer.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/buffer.c,v
retrieving revision 1.4
diff -u -r1.4 buffer.c
--- buffer.c 2001/03/22 05:43:48 1.4
+++ buffer.c 2001/05/11 02:55:08
@@ -59,6 +59,7 @@
}
buf->status = 0;
write (buf->fds[1], "2", 1);
+ shmdt (buf);
_exit(0);
}
@@ -173,5 +174,6 @@
tv.tv_usec = 0;
select (0, NULL, NULL, NULL, &tv);
}
+ shmdt (buf);
}
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list