[vorbis-dev] Possible fix for bug #14 (ogg123 -b memory leak)

Kenneth Arnold ken at arnoldnet.net
Sat May 12 15:22:07 PDT 2001


On Fri, May 11, 2001 at 12:39:31AM -0400, William T. Mahan wrote:
> 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.

The first call is indeed unnecessary; when the process exits
(_exit(0)), all shared memory segments are detached. But the second
call was indeed an error on my part; it worked fine when the buffer
was never freed until exit, but when multiple songs with different
bitrates came into play, the cleanest way to deal with the problem was
to flush and shutdown the buffer entirely each time (because the
devices list otherwise would not get updated; TODO Ken, make devices_t
shared in the shared memory segment and don't kill the buffer every
time).

Or (to all...) is pthreads portable enough to make the writer a thread
instead of a process? (well on Linux at least it would still be
another process, but sharing memory so we don't have to deal with this
sysv shm stuff anymore). Am I correct in assuming that pthreads is
more portable than sysv shared memory? Because if so, I'll dust off
the pthreads manpages and go clean up the buffer mess.


-- 
Kenneth Arnold <ken at arnoldnet.net> / kcarnold / Linux user #180115
http://arnoldnet.net/~kcarnold/



<HR NOSHADE>
<UL>
<LI>application/pgp-signature attachment: stored
</UL>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: part
Type: application/octet-stream
Size: 233 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20010512/9122747e/part.obj


More information about the Vorbis-dev mailing list