Difference between revisions of "Memory Management"

From Suhrid.net Wiki
Jump to navigationJump to search
Line 6: Line 6:
 
** Immortal Memory
 
** Immortal Memory
 
** Scoped Memory
 
** Scoped Memory
 
 
* Both types of area are represented by the abstract javax.realtime.MemoryArea class.
 
* Both types of area are represented by the abstract javax.realtime.MemoryArea class.
 
* Only javax.realtime.Schedulable objects are allowed to enter into a MemoryArea. If standard Java threads attempt to get in then an IllegalThreadStateException is thrown.
 
* Only javax.realtime.Schedulable objects are allowed to enter into a MemoryArea. If standard Java threads attempt to get in then an IllegalThreadStateException is thrown.
 +
* Schedulable objects '''must explicitly indicate''' the MemoryArea to allocate objects from, otherwise the standard Java heap will be used.
  
 
== Immortal Memory ==
 
== Immortal Memory ==
  
 
* The memory associated with objects allocated in immortal memory is '''never GC'ed''' and '''never released''' during the lifetime of the application.
 
* The memory associated with objects allocated in immortal memory is '''never GC'ed''' and '''never released''' during the lifetime of the application.
 +
* The programmer can reuse the memory by other means. e.g. by maintaining a pool of reusable objects.
  
  
 
[[Category:RealTimeJava]]
 
[[Category:RealTimeJava]]

Revision as of 17:10, 1 December 2011

Intro

  • Running garbage collection can have an impact on the response time of a time critical thread.
  • It is necessary to have memory that is not subject to GC.
  • Provides two alternatives to traditional Java heap memory:
    • Immortal Memory
    • Scoped Memory
  • Both types of area are represented by the abstract javax.realtime.MemoryArea class.
  • Only javax.realtime.Schedulable objects are allowed to enter into a MemoryArea. If standard Java threads attempt to get in then an IllegalThreadStateException is thrown.
  • Schedulable objects must explicitly indicate the MemoryArea to allocate objects from, otherwise the standard Java heap will be used.

Immortal Memory

  • The memory associated with objects allocated in immortal memory is never GC'ed and never released during the lifetime of the application.
  • The programmer can reuse the memory by other means. e.g. by maintaining a pool of reusable objects.