Duration of MP3 Files .. createRealizedPlayer memory leak ?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   fustini_alessandro
Posted On:   Monday, July 22, 2002 05:22 AM

Hi, I'm using a function to have the duration of 32221 (!!)mp3 files. But the program after 1000 files show Out of memory. I use jdk 1.3.1_004 and JMF 2.1.1a java version. I have a small function like this : File trackFile = new File(sourceFilename); double duration = 0; if(! trackFile.exists()){ System.out.println("Error !!! File not found"); } else { int size = (int)trackFile.length(); Player player = null; URL url = trackFile.toURL(); player = Manager.createRealizedPlayer(url); javax.media.Time t = player.getDuration(); duration = t.getSeconds(); player.stop(); player.deallocate(); player.close();    More>>

Hi,
I'm using a function to have the duration of 32221 (!!)mp3 files.
But the program after 1000 files show Out of memory.
I use jdk 1.3.1_004 and JMF 2.1.1a java version.

I have a small function like this :

File trackFile = new File(sourceFilename);
double duration = 0;
if(! trackFile.exists()){
System.out.println("Error !!! File not found");
} else {
int size = (int)trackFile.length();
Player player = null;
URL url = trackFile.toURL();
player = Manager.createRealizedPlayer(url);
javax.media.Time t = player.getDuration();
duration = t.getSeconds();
player.stop();
player.deallocate();
player.close();
}
return duration;

in a loop for each file in directory and for every call to this function
abot 500 - 1000 Kb is allocated and never released !

Is it possible a shortcut to avoid this or another method to have the duration of tracks ??

Thanks a lot for all help

   <<Less
About | Sitemap | Contact