• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Object Reuse J2me

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic