Solved

Sound Leakage

Posted on 1998-05-08
3
160 Views
Last Modified: 2010-04-16
In a game I play sounds with the AudioClip class. After 20-30 minutes the game suddenly crashes - the system memory is full. Do you know any workaround for this memory leakage problem?
0
Comment
Question by:bela
  • 3
3 Comments
 
LVL 5

Accepted Solution

by:
fontaine earned 200 total points
ID: 1220824
I read several explanations for this phenomenon. It is a bug in fact and there is nothing you can do programmatically. Here are the interpretations.

1/ Every time that you are calling AudioClip.play(), another channel is opened by AudioDevice (which is part of the sun.audio package). No one knows when the clip is done playing, so it never gets removed from the Vector of channels that AudioDevice is keeping internally. The Vector thus gets longer and longer and finally there is no more memory.

2/ Sometimes, it appears that it fails to close the audio streams in the sound engine, what led to a memory leak when the sound file is played again and again.

My references are:

http://developer.java.sun.com/developer/bugParade/bugs/4072950.html

This is a page of the Java Developer Connection. To have access, you can register for free. If you go to the "Bugs" section and type AudioClip in the query you will have access to some stories similar to your one.
0
 
LVL 5

Expert Comment

by:fontaine
ID: 1220825
0
 
LVL 5

Expert Comment

by:fontaine
ID: 1220826
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question