×
Namespaces

Variants
Actions
Revision as of 07:23, 28 June 2012 by hamishwillee (Talk | contribs)

Archived:Threads may hang on exit and reserve memory even when MIDlet has completed on S60 2nd Edition (Known Issue)

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


Article Metadata
Tested with
Devices(s): Nokia 6600
Compatibility
Platform(s): S60 2nd Edition
S60 2nd Edition (initial release)
Article
Created: User:Technical writer 1 (21 Aug 2007)
Last edited: hamishwillee (28 Jun 2012)

Description

If a MIDlet is running any threads when exiting, the running threads may keep on hanging, thus reserving memory even after the MIDlet has exited.

Solution

Before exiting an application with the Exit command or in some other graceful exit situation, all of the threads have to be killed. This can be done either in the destroyApp() method or in some other user-specified method that is called before exiting the MIDlet, for example, something like the following:

public void commandAction(Command c, Displayable d) {
 
if (c == exitCommand) {
// exit the MIDlet
iRunning = false;
}
 
}
 
public void run()
{
while( iRunning )
{
repaint();
 
serviceRepaints();
 
try{ Thread.sleep(100); }catch( InterruptedException e ){}
}
 
MidletMain.quitApp();
 
}
34 page views in the last 30 days.
×