• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object Reuse J2me

 
Soumitro Chakraborty
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

got 2 questions on J2me and reusing of objects.

1. is it a good idea to reuse the objects of classes under the javax.microedition.lcdui package i mean most of the UI related objects.

2.the second is about reusing a thread for network hits.


Thanks
 
Rashid Mayes
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Object reuse is normally a good practice. However, consider how much memory is available to the application and how frequently an object can/will be reused.

Some devices have issues with creating many UI components; i.e. http://wiki.forum.nokia.com/index.php/KIJ000345_-_Creating_too_many_Canvas_instances_throws_an_outOfMemoryException

Think about the architecture of your application; identify the candidates for reuse.

2) I would suggest using a non-busy wait pattern for networking; queue the network operations and use one or more worker threads to execute the operations.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic