Skip to contentSkip to conversation

memory leaks?

DISCUSSION Lee Revell 2 participants 6 messages Mar 27, 2005 – Mar 30, 2005

lore
Share & tools
lore

Lee Revell

author
#0 lore raw

I recently started getting these messages every time I relaod my ALSA modules:

usbcore: registered new driver snd-usb-audio
usbcore: deregistering driver snd-usb-audio
ALSA /home/rlrevell/cvs/alsa/alsa-driver/usb/usbmidi.c:178: urb status -108
ALSA /home/rlrevell/cvs/alsa/alsa-driver/usb/usbmidi.c:163: usb_submit_urb: -90
ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:71: Not freed snd_alloc_kmalloc = 864 ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e0979806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e09796fe not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e0979806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e09796fe not freed
PCI: Found IRQ 7 for device 0000:00:0f.0
ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:71: Not freed snd_alloc_kmalloc = 432 ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e098a806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e098a6fe not freed
( ksoftirqd/0-2 |#0): new 48 us maximum-latency wakeup.
PCI: Found IRQ 7 for device 0000:00:0f.0
usb 2-2: USB disconnect, address 3

(          IRQ 12-664  |#0): new 51 us maximum-latency wakeup.
(          IRQ 10-2804 |#0): new 70 us maximum-latency wakeup.

ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:71: Not freed snd_alloc_kmalloc = 432 ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e08b4806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e08b46fe not freed
PCI: Found IRQ 7 for device 0000:00:0f.0

(     ksoftirqd/0-2    |#0): new 85 us maximum-latency wakeup.
(     ksoftirqd/0-2    |#0): new 90 us maximum-latency wakeup.
(          IRQ 11-691  |#0): new 100 us maximum-latency wakeup.

Does this indicate a memory leak in ALSA?

Lee

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

#1 lore raw

At Sat, 26 Mar 2005 23:14:46 -0500,

Quoted 25 lines · Lee Revell

I recently started getting these messages every time I relaod my ALSA modules:

usbcore: registered new driver snd-usb-audio
usbcore: deregistering driver snd-usb-audio
ALSA /home/rlrevell/cvs/alsa/alsa-driver/usb/usbmidi.c:178: urb status -108
ALSA /home/rlrevell/cvs/alsa/alsa-driver/usb/usbmidi.c:163: usb_submit_urb: -90
ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:71: Not freed snd_alloc_kmalloc = 864 ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e0979806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e09796fe not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e0979806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e09796fe not freed
PCI: Found IRQ 7 for device 0000:00:0f.0
ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:71: Not freed snd_alloc_kmalloc = 432 ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e098a806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e098a6fe not freed
( ksoftirqd/0-2 |#0): new 48 us maximum-latency wakeup.
PCI: Found IRQ 7 for device 0000:00:0f.0
usb 2-2: USB disconnect, address 3

(          IRQ 12-664  |#0): new 51 us maximum-latency wakeup.
(          IRQ 10-2804 |#0): new 70 us maximum-latency wakeup.

ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:71: Not freed snd_alloc_kmalloc = 432 ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e08b4806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e08b46fe not freed
PCI: Found IRQ 7 for device 0000:00:0f.0

Quoted 5 lines
(     ksoftirqd/0-2    |#0): new 85 us maximum-latency wakeup.
(     ksoftirqd/0-2    |#0): new 90 us maximum-latency wakeup.
(          IRQ 11-691  |#0): new 100 us maximum-latency wakeup.

Does this indicate a memory leak in ALSA?

Yes. Could you trace the corresponding addresses? (just checking /proc/kallsyms before unloading would help, too).

Takashi

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

author
#2 lore raw
Quoted 2 lines · Takashi Iwai

Yes. Could you trace the corresponding addresses? (just checking /proc/kallsyms before unloading would help, too).

How exactly would I trace those addresses?

Anyway, it looks to me that the leak is in snd_seq_midi. Here is the most recent output. The first one I'm not sure about, the second seems to be in snd_seq_midisynth_register_port.

ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:71: Not freed snd_alloc_kmalloc = 432 ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(164) from e098b806 not freed ALSA /home/rlrevell/cvs/alsa/alsa-driver/alsa-kernel/core/memory.c:80: kmalloc(268) from e098b6fe not freed

Here are the closest addresses from kallsyms:

00000000 a seq_midi.c [snd_seq_midi]

e0a37ea0 ? __mod_author43       [snd_seq_midi]
e0a37f00 ? __mod_description44  [snd_seq_midi]
e0a37f44 ? __mod_license45      [snd_seq_midi]
e098d7ec d output_buffer_size   [snd_seq_midi]

e098d7f0 d __param_str_output_buffer_size [snd_seq_midi]
e098be0c r __param_output_buffer_size [snd_seq_midi]
e0a37f60 ? __mod_output_buffer_sizetype47 [snd_seq_midi]
e0a37f80 ? __mod_output_buffer_size48 [snd_seq_midi]
e098d804 d input_buffer_size [snd_seq_midi]
e098d808 d __param_str_input_buffer_size [snd_seq_midi]
e098be20 r __param_input_buffer_size [snd_seq_midi]
e0a37fc0 ? __mod_input_buffer_sizetype50 [snd_seq_midi]
e0a37fe0 ? __mod_input_buffer_size51 [snd_seq_midi]
e098d81c d register_mutex [snd_seq_midi]
e098b000 t snd_midi_input_event [snd_seq_midi]
e098b100 t dump_midi [snd_seq_midi]
e098b1b0 t event_process_midi [snd_seq_midi]
e098b2e0 t snd_seq_midisynth_new [snd_seq_midi]
e098b330 t midisynth_subscribe [snd_seq_midi]
e098b420 t midisynth_unsubscribe [snd_seq_midi]
e098b480 t midisynth_use [snd_seq_midi]
e098b540 t midisynth_unuse [snd_seq_midi]
e098b5c0 t snd_seq_midisynth_delete [snd_seq_midi]
e098b610 t set_client_name [snd_seq_midi]
e098b6a0 t snd_seq_midisynth_register_port [snd_seq_midi]
e098bd68 t .text.lock.seq_midi [snd_seq_midi]
e098d9c0 b synths [snd_seq_midi]
e098bc80 t snd_seq_midisynth_unregister_port [snd_seq_midi]
e098d82c d ops.1 [snd_seq_midi]
e08fd000 t alsa_seq_midi_init [snd_seq_midi]
e098bdf0 t alsa_seq_midi_exit [snd_seq_midi]

HTH,

Lee

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

author
#3 lore raw
Quoted 9 lines · Lee Revell
Quoted 2 lines · Takashi Iwai

Yes. Could you trace the corresponding addresses? (just checking /proc/kallsyms before unloading would help, too).

How exactly would I trace those addresses?

Anyway, it looks to me that the leak is in snd_seq_midi. Here is the most recent output. The first one I'm not sure about, the second seems to be in snd_seq_midisynth_register_port.

I might have found it. The info structure allocated in snd_seq_midisynth_register_port does not seem to be freed in snd_seq_midisynth_unregister_port, except on the error paths.

Lee

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

#4 lore raw

At Tue, 29 Mar 2005 16:31:56 -0500,

Quoted 8 lines · Lee Revell
Quoted 6 lines · Lee Revell
Quoted 2 lines · Takashi Iwai

Yes. Could you trace the corresponding addresses? (just checking /proc/kallsyms before unloading would help, too).

How exactly would I trace those addresses?

Quoted 7 lines
Quoted 3 lines

Anyway, it looks to me that the leak is in snd_seq_midi. Here is the most recent output. The first one I'm not sure about, the second seems to be in snd_seq_midisynth_register_port.

I might have found it. The info structure allocated in snd_seq_midisynth_register_port does not seem to be freed in snd_seq_midisynth_unregister_port, except on the error paths.

Nice catch. Does the patch below fix the problem?

Takashi

Index: alsa-kernel/core/seq/seq_midi.c
===================================================================
RCS file: /home/iwai/cvs/alsa/alsa-kernel/core/seq/seq_midi.c,v retrieving revision 1.26

core/seq/seq_midi.c +1 -0
diff -u -r1.26 seq_midi.c
@@ -414,6 +414,7 @@
 	if (newclient)
 		synths[card->number] = client;
 	up(&register_mutex);
+	kfree(info);
 	return 0;	/* success */
 
       __nomem:
#5 lore raw

At Wed, 30 Mar 2005 14:08:05 +0200,

Quoted 2 lines · I wrote:

Nice catch. Does the patch below fix the problem?

I found it's not enough. Try this one please.
(I'll commit this to CVS now, anyway.)

Takashi

Index: alsa-kernel/core/seq/seq_midi.c
===================================================================
RCS file: /home/iwai/cvs/alsa/alsa-kernel/core/seq/seq_midi.c,v retrieving revision 1.26

core/seq/seq_midi.c +2 -0
diff -u -r1.26 seq_midi.c
@@ -414,6 +414,8 @@
 	if (newclient)
 		synths[card->number] = client;
 	up(&register_mutex);
+	kfree(info);
+	kfree(port);
 	return 0;	/* success */
 
       __nomem: