On Tue, 26 Aug 2003, [iso-8859-1] Mĺns Rullgĺrd wrote:

> Jaroslav Kysela <[EMAIL PROTECTED]> writes:
> 
> >> Is there a memory leak in alsa-lib?  When playing music with a player
> >> I'm writing (TCVP, http://tcvp.sf.net), the memory usage reported by
> >> top grows for each file I play, but only if I use ALSA for sound
> >> playback.  If I use OSS the memory usage varies around 1.5 MB, but if
> >> I use ALSA, it starts at 1.9 MB (OK, libasound takes some space) and
> >> grows by 30-40 kB for each played file.  Running the whole thing under
> >> valgrind gives me this, which is all alsa-related.  When using OSS,
> >> valgrind reports no leaks.
> >
> > I tested aplay with valgrind and I cannot find any leak (except a few 
> > allocations probably from glibc). Note that you have to use 
> > snd_config_update_free_global() after end of the session to free
> 
> OK, so what constitutes a session?  A snd_pcm_open/snd_pcm_close pair?
> Won't snd_pcm_open reuse the data from a previous call?
> 
> I added that call after my call to snd_pcm_open, and valgrind no
> longer reports any leaks, except for a few kilobytes from a flex
> scanner (not related to alsa).  Still, the memory used by the player
> when running increases with each file.  The virtual size of the player
> is rather constant at around 25 MB all the time, while the resident
> size is slowly increasing, until it too reaches 25 MB.  Then the
> impossible happens:
> 
>   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
>  7148 mru       11   0 25160  27m 2740 S  0.0 12.4   0:00.08 tcvp              
> 
> Now the man page for top tells me that "VIRT = SWAP + RES", so unless
> a negative amount has been swapped (what would that mean?), something
> strange is going on.  The odd thing is that this happens only when I
> use the ALSA output module.  Could it be that alsa-lib triggers some
> bug somewhere in top, or in the kernel?  This seems a little unlikely,
> though.

I will try to investigate this problem.

> In case it matters, I use ALSA OSS emulation when testing OSS sound.
> 
> > the configuration cache in alsa-lib. This is described in 
> > the alsa-lib/MEMORY-LEAK file.
> 
> That file isn't present in the alsa-lib 0.9.6 tarball.  It should be
> added the EXTRA_DIST list in Makefile.am.

Thanks for info. Fixed.

> I ran valgrind on aplay, and it tells me more or less the same as for
> my program.  Does aplay not call the above function?  Not that it
> needs to, really.

I've added the free function to aplay before tests, of course.

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to