Solved

Sound Leakage

Posted on 1998-05-08
3
164 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

624 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