×
Namespaces

Variants
Actions

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
CompatibilityArticle
Created: User:Technical writer 1 (21 Aug 2007)
Last edited: hamishwillee (23 Oct 2013)

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();
 
}
This page was last modified on 23 October 2013, at 08:41.
24 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×