SlideShare una empresa de Scribd logo
1 de 18
Descargar para leer sin conexión
Memory Optimizing Java ME
applications

Sreekumar Pillai , CTO, Experion
Java ME Platform

§ Java ME devices often are consumer devices which
   has resource constraints

§ Mobile devices are not small PCs

§ Applications are to make best use of the available
   resources

§ Development requires a different mindset which
   expects unexpected things !
Why memory optimization?

§ Functionality is often given priority in initial phases
   of development

§ Performance tuning takes a backseat and generally
   developers ignore efficient usage of memory

§ Memory issues are hard to fix

§ In Java ME this can be fatal and midlet may not run
   at all
Java ME Enterprise applications

§ Enterprise applications are mostly used by staff to
   perform operations while they are on Field

§ Typically such applications require to connect to a
   backend server for data access

§ Volume of data can be a bottleneck and requires
   careful design and optimization
Java ME Memory architecture

§ Automatic memory management is part of JVM

§ Heap
 -  Heap is created by JVM at startup
 -  Class instances are allocated in Heap
 -  Size of Heap is typically fixed to 2Mb (low end devices)

§ Garbage Collection
 -  JVM Specification mandates a garbage collection mechanism
 -  Programmer is not allowed to explicitly deallocate the memory of
    an object
Garbage collection

§ There is no concept of a pointer in Java

§ Memory management is left to JVM

§ GC is provided by JVM to reclaim the unreferenced
   memory

§ An object is eligible for garbage collection if it can
   not be accessed by any live thread
Detecting memory issues

§ Exceptions
 -  JVM Throws OutOfMemoryError
 -  When trying to allocate more memory than available as a
    single chunk


§ Memory Profiler
 -  See the objects being allocated and the memory they
    occupy
 -  Set the available amount of memory and stress the
    application
Memory profiler
Memory profiler
How do we optimize ?
Object allocations
§ Use as few as possible

§ Dereference objects(set to NULL) to enable GC

§ Reuse objects

§ Heap fragmentation
 -  See the possibility of doing large allocations first


§ Catch OutOfMemoryError for large allocations
Reorganize UI Navigation

§ Having more UI elements in a single screen
   increases the memory requirment
§ Good to reduce the data presented in a single
   screen
§ Long lists & scrolling does not result in good user
   experience
§ Split the data into multiple screens ( e.g. a product
   catalogue can be splitted into category, sub
   category, and item screens )
Data representations
§ XML
 -  XML is suitable for hierarchical data like a product
    catalogue
 -  XML is lengthy and occupies more bandwidth


§ JSON
 -  Simple than XML
 -  More popular among developers


§ CSV / Custom Fixed length
 -  Full control over data format and parsing
XML Vs JSON
<widget>                                            {"widget": {
  <debug>on</debug>                                    "debug": "on",
                                                       "window": {
  <window title="Sample Konfabulator Widget">
                                                          "title": "Sample Konfabulator Widget",
     <name>main_window</name>                             "name": "main_window",
     <width>500</width>                                   "width": 500,
     <height>500</height>                                 "height": 500
  </window>                                            },
                                                       "image": {
  <image src="Images/Sun.png" name="sun1">
                                                          "src": "Images/Sun.png",
     <hOffset>250</hOffset>                               "name": "sun1",
     <vOffset>250</vOffset>                               "hOffset": 250,
     <alignment>center</alignment>                        "vOffset": 250,
                                                          "alignment": "center"
  </image>
                                                       },
  <text data="Click Here" size="36" style="bold">
                                                       "text": {
     <name>text1</name>                                   "data": "Click Here",
     <hOffset>250</hOffset>                               "size": 36,
     <vOffset>100</vOffset>                               "style": "bold",
     <alignment>center</alignment>                        "name": "text1",
                                                          "hOffset": 250,
     <onMouseUp>
                                                          "vOffset": 100,
       sun1.opacity = (sun1.opacity / 100) * 90;          "alignment": "center",
     </onMouseUp>                                         "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
  </text>                                              }
</widget>                                           }}
Optimizing XML / JSON

§ Reduce size of tags / keys
  § <Product code>PT1432</Product code>


§ Reduce the number of fields required in client side
 -  Very generalized web services is an overhead for client
    applciations


§ Parsers are memory intensive - For large data
   strings alternate options to be considered
RMS - Alternate storage

§ RMS RecordStore can be used for storing data
   when size is high

§ RecordStore can be addressed using a name tag

§ Organize data – Read required information into
   memory
JAR Size

§ Reduce size of classes
 -  Use an obfuscator to minimize the size of classes


§ Themes
 -  Do you require multiple themes ?


§ Images
 -  Minimize resource sizes
 -  Use fewer colors as possible
Thank you ...

Más contenido relacionado

La actualidad más candente

Experience Manager 6 Developer Features - Highlights
Experience Manager 6 Developer Features - HighlightsExperience Manager 6 Developer Features - Highlights
Experience Manager 6 Developer Features - HighlightsCédric Hüsler
 
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 ThemeCreating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 ThemeAcquia
 
You Tube Video Link
You Tube Video LinkYou Tube Video Link
You Tube Video Linkdewriter
 
Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)Eugenio Minardi
 
Progressive Downloads and Rendering
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and RenderingStoyan Stefanov
 
Grok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb updateGrok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb updateLaura Scott
 
Vídeo.1
Vídeo.1Vídeo.1
Vídeo.1home
 
Drupal distributions - how to build them
Drupal distributions - how to build themDrupal distributions - how to build them
Drupal distributions - how to build themDick Olsson
 

La actualidad más candente (10)

Css multi background
Css   multi backgroundCss   multi background
Css multi background
 
Experience Manager 6 Developer Features - Highlights
Experience Manager 6 Developer Features - HighlightsExperience Manager 6 Developer Features - Highlights
Experience Manager 6 Developer Features - Highlights
 
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 ThemeCreating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
 
You Tube Video Link
You Tube Video LinkYou Tube Video Link
You Tube Video Link
 
The web context
The web contextThe web context
The web context
 
Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)
 
Progressive Downloads and Rendering
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and Rendering
 
Grok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb updateGrok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb update
 
Vídeo.1
Vídeo.1Vídeo.1
Vídeo.1
 
Drupal distributions - how to build them
Drupal distributions - how to build themDrupal distributions - how to build them
Drupal distributions - how to build them
 

Destacado

Visual Programming
Visual ProgrammingVisual Programming
Visual ProgrammingBagzzz
 
1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessor1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessortechbed
 
Phy i assign&answers_2011
Phy i assign&answers_2011Phy i assign&answers_2011
Phy i assign&answers_2011Sufi Sulaiman
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architectureprasadpawaskar
 

Destacado (8)

Roadmap 2018 - VPL in Iceland
Roadmap 2018 - VPL in IcelandRoadmap 2018 - VPL in Iceland
Roadmap 2018 - VPL in Iceland
 
Kid Safe Democracy Work
Kid Safe Democracy WorkKid Safe Democracy Work
Kid Safe Democracy Work
 
Visual Programming
Visual ProgrammingVisual Programming
Visual Programming
 
Memory mgmt 80386
Memory mgmt 80386Memory mgmt 80386
Memory mgmt 80386
 
1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessor1326 Introduction To 8086 Microprocessor
1326 Introduction To 8086 Microprocessor
 
Phy i assign&answers_2011
Phy i assign&answers_2011Phy i assign&answers_2011
Phy i assign&answers_2011
 
Secondary Memory
Secondary MemorySecondary Memory
Secondary Memory
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 

Similar a Experion Presentation at JavaOne 2011: Memory optimizing Java ME applications

Responsive Websites
Responsive WebsitesResponsive Websites
Responsive WebsitesJoe Seifi
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVCAlive Kuo
 
Nanoformats
NanoformatsNanoformats
Nanoformatsrozario
 
Top 10 HTML5 features
Top 10 HTML5 featuresTop 10 HTML5 features
Top 10 HTML5 featuresGill Cleeren
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX DesignersAshlimarie
 
Practical Responsive Images - from Second Wednesday
Practical Responsive Images - from Second WednesdayPractical Responsive Images - from Second Wednesday
Practical Responsive Images - from Second WednesdayBen Seymour
 
Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Andreas Bovens
 
SharePoint 2010 Training Session 6
SharePoint 2010 Training Session 6SharePoint 2010 Training Session 6
SharePoint 2010 Training Session 6Usman Zafar Malik
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. The University of Akron
 
Presentation html5 css3 by thibaut
Presentation html5 css3 by thibautPresentation html5 css3 by thibaut
Presentation html5 css3 by thibautThibaut Baillet
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天tblanlan
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-futureyiming he
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayTodd Anglin
 
gDayX - Advanced angularjs
gDayX - Advanced angularjsgDayX - Advanced angularjs
gDayX - Advanced angularjsgdgvietnam
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flexdanielwanja
 
Responsive Design: Mehr als CSS
Responsive Design: Mehr als CSSResponsive Design: Mehr als CSS
Responsive Design: Mehr als CSSWalter Ebert
 
20190118_NetadashiMeetup#8_React2019
20190118_NetadashiMeetup#8_React201920190118_NetadashiMeetup#8_React2019
20190118_NetadashiMeetup#8_React2019Makoto Mori
 
Responsive WordPress workflow
Responsive WordPress workflowResponsive WordPress workflow
Responsive WordPress workflowJames Bundey
 
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5Cengage Learning
 

Similar a Experion Presentation at JavaOne 2011: Memory optimizing Java ME applications (20)

Responsive Websites
Responsive WebsitesResponsive Websites
Responsive Websites
 
[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC[Coscup 2012] JavascriptMVC
[Coscup 2012] JavascriptMVC
 
Nanoformats
NanoformatsNanoformats
Nanoformats
 
Top 10 HTML5 features
Top 10 HTML5 featuresTop 10 HTML5 features
Top 10 HTML5 features
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
Practical Responsive Images - from Second Wednesday
Practical Responsive Images - from Second WednesdayPractical Responsive Images - from Second Wednesday
Practical Responsive Images - from Second Wednesday
 
Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...Responsive design: techniques and tricks to prepare your websites for the mul...
Responsive design: techniques and tricks to prepare your websites for the mul...
 
SharePoint 2010 Training Session 6
SharePoint 2010 Training Session 6SharePoint 2010 Training Session 6
SharePoint 2010 Training Session 6
 
Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors. Managing responsive websites with css preprocessors.
Managing responsive websites with css preprocessors.
 
Create a landing page
Create a landing pageCreate a landing page
Create a landing page
 
Presentation html5 css3 by thibaut
Presentation html5 css3 by thibautPresentation html5 css3 by thibaut
Presentation html5 css3 by thibaut
 
KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天KISSY 的昨天、今天与明天
KISSY 的昨天、今天与明天
 
kissy-past-now-future
kissy-past-now-futurekissy-past-now-future
kissy-past-now-future
 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
 
gDayX - Advanced angularjs
gDayX - Advanced angularjsgDayX - Advanced angularjs
gDayX - Advanced angularjs
 
Building iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360FlexBuilding iPad apps with Flex - 360Flex
Building iPad apps with Flex - 360Flex
 
Responsive Design: Mehr als CSS
Responsive Design: Mehr als CSSResponsive Design: Mehr als CSS
Responsive Design: Mehr als CSS
 
20190118_NetadashiMeetup#8_React2019
20190118_NetadashiMeetup#8_React201920190118_NetadashiMeetup#8_React2019
20190118_NetadashiMeetup#8_React2019
 
Responsive WordPress workflow
Responsive WordPress workflowResponsive WordPress workflow
Responsive WordPress workflow
 
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5
Course Tech 2013, Sasha Vodnik, A Crash Course in HTML5
 

Último

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Experion Presentation at JavaOne 2011: Memory optimizing Java ME applications

  • 1. Memory Optimizing Java ME applications Sreekumar Pillai , CTO, Experion
  • 2. Java ME Platform § Java ME devices often are consumer devices which has resource constraints § Mobile devices are not small PCs § Applications are to make best use of the available resources § Development requires a different mindset which expects unexpected things !
  • 3. Why memory optimization? § Functionality is often given priority in initial phases of development § Performance tuning takes a backseat and generally developers ignore efficient usage of memory § Memory issues are hard to fix § In Java ME this can be fatal and midlet may not run at all
  • 4. Java ME Enterprise applications § Enterprise applications are mostly used by staff to perform operations while they are on Field § Typically such applications require to connect to a backend server for data access § Volume of data can be a bottleneck and requires careful design and optimization
  • 5. Java ME Memory architecture § Automatic memory management is part of JVM § Heap -  Heap is created by JVM at startup -  Class instances are allocated in Heap -  Size of Heap is typically fixed to 2Mb (low end devices) § Garbage Collection -  JVM Specification mandates a garbage collection mechanism -  Programmer is not allowed to explicitly deallocate the memory of an object
  • 6. Garbage collection § There is no concept of a pointer in Java § Memory management is left to JVM § GC is provided by JVM to reclaim the unreferenced memory § An object is eligible for garbage collection if it can not be accessed by any live thread
  • 7. Detecting memory issues § Exceptions -  JVM Throws OutOfMemoryError -  When trying to allocate more memory than available as a single chunk § Memory Profiler -  See the objects being allocated and the memory they occupy -  Set the available amount of memory and stress the application
  • 10. How do we optimize ?
  • 11. Object allocations § Use as few as possible § Dereference objects(set to NULL) to enable GC § Reuse objects § Heap fragmentation -  See the possibility of doing large allocations first § Catch OutOfMemoryError for large allocations
  • 12. Reorganize UI Navigation § Having more UI elements in a single screen increases the memory requirment § Good to reduce the data presented in a single screen § Long lists & scrolling does not result in good user experience § Split the data into multiple screens ( e.g. a product catalogue can be splitted into category, sub category, and item screens )
  • 13. Data representations § XML -  XML is suitable for hierarchical data like a product catalogue -  XML is lengthy and occupies more bandwidth § JSON -  Simple than XML -  More popular among developers § CSV / Custom Fixed length -  Full control over data format and parsing
  • 14. XML Vs JSON <widget> {"widget": { <debug>on</debug> "debug": "on", "window": { <window title="Sample Konfabulator Widget"> "title": "Sample Konfabulator Widget", <name>main_window</name> "name": "main_window", <width>500</width> "width": 500, <height>500</height> "height": 500 </window> }, "image": { <image src="Images/Sun.png" name="sun1"> "src": "Images/Sun.png", <hOffset>250</hOffset> "name": "sun1", <vOffset>250</vOffset> "hOffset": 250, <alignment>center</alignment> "vOffset": 250, "alignment": "center" </image> }, <text data="Click Here" size="36" style="bold"> "text": { <name>text1</name> "data": "Click Here", <hOffset>250</hOffset> "size": 36, <vOffset>100</vOffset> "style": "bold", <alignment>center</alignment> "name": "text1", "hOffset": 250, <onMouseUp> "vOffset": 100, sun1.opacity = (sun1.opacity / 100) * 90; "alignment": "center", </onMouseUp> "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" </text> } </widget> }}
  • 15. Optimizing XML / JSON § Reduce size of tags / keys § <Product code>PT1432</Product code> § Reduce the number of fields required in client side -  Very generalized web services is an overhead for client applciations § Parsers are memory intensive - For large data strings alternate options to be considered
  • 16. RMS - Alternate storage § RMS RecordStore can be used for storing data when size is high § RecordStore can be addressed using a name tag § Organize data – Read required information into memory
  • 17. JAR Size § Reduce size of classes -  Use an obfuscator to minimize the size of classes § Themes -  Do you require multiple themes ? § Images -  Minimize resource sizes -  Use fewer colors as possible