Archived:Repeating socket connections with default access point result in Out of Memory exception in the Nokia N95 (Known Issue)
When making several socket connections with a default access point with the Nokia N95, an Out of Memory exception will be thrown. If the socket MIDlet will remain open after the exception, any attempt to connect to the network (for example, by using a Web browser) results in a new Out of Memory exception. However, when using the device's other applications, no exceptions will be thrown, suggesting that the problem is originating from the number of socket connections. After closing the socket MIDlet, connecting to the network with other applications succeeds and no exception will be thrown.
How to reproduce
The problem can be reproduced with a test MIDlet which makes recursive socket connection calls. The basic code for a test MIDlet can be as follows:
SocketConnection socon = null;
InputStream inputs = null;
OutputStream outputs = null;
socon = (SocketConnection) Connector.open("socket://address.com:portNumber");
outputs = socon.openOutputStream();
inputs = socon.openDataInputStream();
For example, make a GET request for fetching a Web page and write it to the output stream:
StringBuffer req = new StringBuffer(intSize);
.. // Append HTTP, Content type and other data here
int c = inputs.read(); // Read the feedback from the Web to input stream
// Handle the input here
} //closing the while(!recursive) loop
- Install the test MIDlet.
- Go to Menu > Settings > Application Manager > <Test MIDlet> > Open > Access Point and select a properly configured Access Point.
- Start the test MIDlet.
- Allow the MIDlet to access the Internet. After about 150-200 connections an OutOfMemoryError will be thrown and no new socket connections can be made.
- Put the test MIDlet in the background. Start the native Web browser and try going to an URL.
- Close the test MIDlet and try again to go to an URL using the native Web browser.
No solution for S60 3rd Edition FP1. This is expected to be fixed in future software releases.