<Sound Dev> Stream objects not garbage collected?

HAAS Christian Christian.Haas at frequentis.com
Fri Jun 15 07:14:14 PDT 2012


Hello there!

We have been using IcedTea/PulseAudio for some load tests for playing audio and came across a memory leak which we are now searching.
Test setup: Create a Clip object of some arbitrary sound file, play it once, then close it – rinse and repeat, many times.

After a few hours we came across an out of memory exception. Analysing the memory dump we found that all Clip objects were still active, with the garbage collector root being "JNI Global" for the stream objects that each Clip is creating. See attached image showing a selected Clip object. The clip itself was kept alive through callback interfaces to Stream, but isOpen=false proves that close() was called.

I then proceeded to go through the code of icedtea6-1.9.13 and came across the Stream.java / org_classpath_icedtea_pulseaudio_Stream.c pair.
The native function for native_pa_stream_new() does the call to NewGlobalRef() to keep the Stream object alive – presumably for the callbacks. But I didn't find the complementary call to DeleteGlobalRef().
I'd assume this should be done in native_pa_stream_unref(), as this one is the last to be called from PulseAudioDataLine.close() -> Stream.free() .

How is the stream expected to be released properly? Are we missing something or is this leak genuine?
For now we will modify our code to keep and reuse the Clip objects, but it would be good to know the root cause.

Thanks and kind regards,
ch
____________________________________________________
Christian Haas
Software Engineer
FREQUENTIS AG

Innovationsstraße 1, 1100 Vienna, Austria
Phone   +43-1-811 50 – 8353
Mobile   +43-664-60 850 – 8353
Fax       +43-1-811 50 – 77 8353
Web      www.frequentis.com
E-Mail    christian.haas at frequentis.com<mailto:christian.haas at frequentis.com>

Handelsgericht Wien (Vienna Commercial Court): FN 72115 b
DVR 0364797, ATU 14715600
____________________________________________________
Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail sind nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20120615/b6f515cf/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dump.png
Type: image/png
Size: 57444 bytes
Desc: dump.png
Url : http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20120615/b6f515cf/dump-0001.png 


More information about the sound-dev mailing list