File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes Memory Exception!!! Help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Memory Exception!!! Help needed " Watch "Memory Exception!!! Help needed " New topic
Author

Memory Exception!!! Help needed

Somnath Das
Greenhorn

Joined: Jun 06, 2006
Posts: 11
Hello Everyone,

Warm Greetings!,


I am building up an application, which is basically to do with File Transfer over Bluetooth.

When we run our application, on two devices, having one as sender and other as receiver, I get java.lang.MemoryOutOfException on the sender.

The logic I am using is, I am creating a array of byte and loading the entire file on a particular port, so that the client can receive the data from the Port. But, this doesn�t work, as it gives Memory Exception on the sender itself.

But, if we use the default bluetooth transfer on a mobile phone, any file size goes through without any problem.

I am trying to simulate the same device bluetooth transfer.

Can anyone please help me in solving, either my problem or my logic.

Thanks in advance,

Regards,
Somnath Das


Sun Certified Java Programmer (1.4)<br /> <br />(Progress isn't made by early risers, But by lazy people, trying to find easier ways to do the same)
Isuru Sampath
Ranch Hand

Joined: Jun 26, 2003
Posts: 57
If you're getting an Out Of Memory error it could very well be due to a coding bug. Check whether you are having any conditions that will result memory leaks. You can use a profiler to detect this. Pay special attention to the conditions in your loops.

I am creating a array of byte and loading the entire file on a particular port
, why do you do this? you can obtain an input stream from the file for reading it. I don't see why do you need to load the whole file into a byte array. If your file is larger than the allocated heap (keep in mind that you are programming for a limited resource device), this could also result the same error.


No Winds No Waves
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Memory Exception!!! Help needed