🗊Презентация The Basics of Object Lifetime. Disposing objects (Java)

Нажмите для полного просмотра!
The Basics of Object Lifetime. Disposing objects (Java), слайд №1The Basics of Object Lifetime. Disposing objects (Java), слайд №2The Basics of Object Lifetime. Disposing objects (Java), слайд №3The Basics of Object Lifetime. Disposing objects (Java), слайд №4The Basics of Object Lifetime. Disposing objects (Java), слайд №5The Basics of Object Lifetime. Disposing objects (Java), слайд №6The Basics of Object Lifetime. Disposing objects (Java), слайд №7The Basics of Object Lifetime. Disposing objects (Java), слайд №8The Basics of Object Lifetime. Disposing objects (Java), слайд №9The Basics of Object Lifetime. Disposing objects (Java), слайд №10The Basics of Object Lifetime. Disposing objects (Java), слайд №11The Basics of Object Lifetime. Disposing objects (Java), слайд №12The Basics of Object Lifetime. Disposing objects (Java), слайд №13The Basics of Object Lifetime. Disposing objects (Java), слайд №14The Basics of Object Lifetime. Disposing objects (Java), слайд №15The Basics of Object Lifetime. Disposing objects (Java), слайд №16The Basics of Object Lifetime. Disposing objects (Java), слайд №17The Basics of Object Lifetime. Disposing objects (Java), слайд №18The Basics of Object Lifetime. Disposing objects (Java), слайд №19The Basics of Object Lifetime. Disposing objects (Java), слайд №20

Вы можете ознакомиться и скачать презентацию на тему The Basics of Object Lifetime. Disposing objects (Java). Доклад-сообщение содержит 20 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1





The Basics of Object Lifetime.
Disposing objects.
Описание слайда:
The Basics of Object Lifetime. Disposing objects.

Слайд 2





AGENDA
The Basics of Object Lifetime
Building Finalizable Objects
Building Disposable Objects
Dispose pattern
Описание слайда:
AGENDA The Basics of Object Lifetime Building Finalizable Objects Building Disposable Objects Dispose pattern

Слайд 3





The Basics of Object Lifetime
Описание слайда:
The Basics of Object Lifetime

Слайд 4





The Basics of Object Lifetime
Описание слайда:
The Basics of Object Lifetime

Слайд 5





The Role of Application Roots
Root is a storage location containing a reference to an object on the managed heap:
         • References to global objects
         • References to any static objects/static fields
         • References to local objects within an application’s code base
         • References to object parameters passed into a method
        • References to objects waiting to be finalized
        • Any CPU register that references an object
Описание слайда:
The Role of Application Roots Root is a storage location containing a reference to an object on the managed heap: • References to global objects • References to any static objects/static fields • References to local objects within an application’s code base • References to object parameters passed into a method • References to objects waiting to be finalized • Any CPU register that references an object

Слайд 6





Object Generations
Each object on the heap belongs to one of the following generations:
      • Generation 0: Identifies a newly allocated object that has never been marked for collection.
      • Generation 1: Identifies an object that has survived a garbage collection (i.e., it was marked for collection but was not removed due to the fact that the sufficient heap space was acquired).
     • Generation 2: Identifies an object that has survived more than one sweep of the garbage collector.
Описание слайда:
Object Generations Each object on the heap belongs to one of the following generations: • Generation 0: Identifies a newly allocated object that has never been marked for collection. • Generation 1: Identifies an object that has survived a garbage collection (i.e., it was marked for collection but was not removed due to the fact that the sufficient heap space was acquired). • Generation 2: Identifies an object that has survived more than one sweep of the garbage collector.

Слайд 7





Building Finalizable Objects
 Rule The reason to override Finalize() is if your C# class is making use of unmanaged resources via PInvoke or complex COM interoperability tasks. The reason is that you are manipulating memory that the CLR cannot manage.
Описание слайда:
Building Finalizable Objects  Rule The reason to override Finalize() is if your C# class is making use of unmanaged resources via PInvoke or complex COM interoperability tasks. The reason is that you are manipulating memory that the CLR cannot manage.

Слайд 8





Building Finalizable Objects
You can’t override the Finalize() method directly in your class, but you may use of a destructor syntax to achieve the same effect.
Destructor never takes an access modifier (implicitly protected), never takes parameters, and can’t be overloaded (only one finalizer per class).
Описание слайда:
Building Finalizable Objects You can’t override the Finalize() method directly in your class, but you may use of a destructor syntax to achieve the same effect. Destructor never takes an access modifier (implicitly protected), never takes parameters, and can’t be overloaded (only one finalizer per class).

Слайд 9





Building Disposable Objects
Описание слайда:
Building Disposable Objects

Слайд 10


The Basics of Object Lifetime. Disposing objects (Java), слайд №10
Описание слайда:

Слайд 11


The Basics of Object Lifetime. Disposing objects (Java), слайд №11
Описание слайда:

Слайд 12





using
Описание слайда:
using

Слайд 13





?
Описание слайда:
?

Слайд 14





Dispose pattern
The Dispose Pattern is intended to standardize the usage and implementation of finalizers and the IDisposable interface.
	√ DO implement the Basic Dispose Pattern on types containing instances of disposable types. 
	√ DO implement the Basic Dispose Pattern and provide a finalizer on types holding resources that need to be freed explicitly and that do not have finalizers.
	√ CONSIDER implementing the Basic Dispose Pattern on classes that themselves don’t hold unmanaged resources or disposable objects but are likely to have subtypes that do.
Описание слайда:
Dispose pattern The Dispose Pattern is intended to standardize the usage and implementation of finalizers and the IDisposable interface. √ DO implement the Basic Dispose Pattern on types containing instances of disposable types. √ DO implement the Basic Dispose Pattern and provide a finalizer on types holding resources that need to be freed explicitly and that do not have finalizers. √ CONSIDER implementing the Basic Dispose Pattern on classes that themselves don’t hold unmanaged resources or disposable objects but are likely to have subtypes that do.

Слайд 15





Dispose pattern
Involves implementing the System.IDisposable interface 
Declare the Dispose(bool) method that implements all resource cleanup logic to be shared between the Dispose method and the optional finalizer.
Описание слайда:
Dispose pattern Involves implementing the System.IDisposable interface Declare the Dispose(bool) method that implements all resource cleanup logic to be shared between the Dispose method and the optional finalizer.

Слайд 16





Dispose pattern
DO NOT make the parameterless Dispose method virtual.
The Dispose(bool) method is the one that should be overridden by subclasses.
Описание слайда:
Dispose pattern DO NOT make the parameterless Dispose method virtual. The Dispose(bool) method is the one that should be overridden by subclasses.

Слайд 17





Dispose pattern
√ DO allow the Dispose(bool) method to be called more than once. The method might choose to do nothing after the first call.
Описание слайда:
Dispose pattern √ DO allow the Dispose(bool) method to be called more than once. The method might choose to do nothing after the first call.

Слайд 18





Dispose pattern
√ DO throw an ObjectDisposedException from any member that cannot be used after the object has been disposed of.
Описание слайда:
Dispose pattern √ DO throw an ObjectDisposedException from any member that cannot be used after the object has been disposed of.

Слайд 19





Dispose pattern
√ CONSIDER providing method Close(), in addition to the Dispose(), if close is standard terminology in the area.
Описание слайда:
Dispose pattern √ CONSIDER providing method Close(), in addition to the Dispose(), if close is standard terminology in the area.

Слайд 20





Questions ?
Описание слайда:
Questions ?



Похожие презентации
Mypresentation.ru
Загрузить презентацию