I am trying to build a networking midlet, and I am using HttpConnection to transfer data to and from the server. I have to open a new HttpConnection everytime i need to send data to or get data from the server. The data transmission part now works, but the midlet is not stable, and it always ends up with a "Global root overflow" exception. Anyone has any idea about this exception?
I have searched the web and the only one result I got is that:
"Global root overflow" means that the native code is registering too many "permanent references" with the garbage collector. Try reusing the connection, allocation of connection-specific data (like socket descriptor etc) might be "leaking".
Well, I think I can't "reuse" the connection, because as I tested out on the phone (Nokia 6610, not the emulator), there is no way I can use persistent connection, nor chunked HTTP. Seems like one of the bugs in the Nokia HTTP implementation.
MIDlet using Http connection causes sometimes
"global root overflow" error message.
In the software versions before January 2003 there was an error where the HTTP API could cause a global root overflow.
Since January 2003 problem was fixed (7210) and does not accur with these later SW versions.
The global root overflow only occurs if a lot of HTTP requests are made and there is no data in the response,
so the simple solution is to ensure that the problem does not occur on any build is to make sure each
HTTP response does contain some body data, the MIDlet can read and discard this if none is expected.