Hello, I am trying to process an audio file,but the size of the music file about 72.3Mb,when i am trying to run it, it displays: java.lang.OutOfMemoryError: java heap space.So what is the problem,Can't I process this much amount of data size. Thanks
[ EJFH: Changed subject line. ] [ May 18, 2006: Message edited by: Ernest Friedman-Hill ]
By default, Java usually runs with a maximum heap size of 64 MB. You can increase this using the -Xmx option, for example:
java -Xmx256m MyClass
runs MyClass with a maximum heap size of 256 MB. Note that depending on how your program handles the file, you may well need more than just 72.3 MB.
Also, I don't know what sort of processing you're doing, or what APIs you're using, but it would quite possibly be a good idea to find a way to process the data a little bit at a time, so that you aren't forced to load the entire file into memory at once. A streaming solution would be nice. It's something to think about, anyway...
Well, um... EFH just gave you an example. Let's try this. You say you are "trying to process an audio file". Are you using the Java programming language to do this? How do you start this program or application or whatever it is? Is it something you wrote youself, or did you get it from somewhere? If it's some commercial software - what's it called? If you wrote it in Java - are you using an IDE, such as IntelliJ, Eclipse, WSAD, JDeveloper, JBuilde, or something else? This information will (hopefully) help us to answer your question in terms that will make better sense for you.
Originally posted by wondwosen Getachew: Hello, I am trying to process an audio file,but the size of the music file about 72.3Mb,when i am trying to run it, it displays: java.lang.OutOfMemoryError: java heap space.So what is the problem,Can't I process this much amount of data size. Thanks
See, you have 72.5 Mb file now and getting problem , you can solve this by increaing the heap. But what, in future if you need 1000Mb what will you do?
So the best solution is packet method or divide and get. Let one thread play the song and another thread assist in getting the data in packets to play.
Ok,let me do things clear, I am working on digital audio watermarking as my final year project,and I am using java,JDK1.5,and TextPad,And while I am processing the audio data,The above run time problem is displayed,So plseas tell me where should I put Xmx256m to increase heap size, plase give me a concreat solution for this problem ok. Thanks alot.
So what you're saying is that when you run your program, it's via a TextPad command, yes? So now your question is "How do I add Java switches to the command line used by TextPad to run my Java program?"
My first recourse here would be TextPad's online help. I'm going to move this thread now to our IDEs forum. If you can't find the info you need in the online help, then perhaps someone who uses TextPad can give you some advice in that forum.