Reader small image

You're reading from  C# 7 and .NET Core 2.0 High Performance

Product typeBook
Published inApr 2018
Reading LevelBeginner
Publisher
ISBN-139781788470049
Edition1st Edition
Languages
Right arrow
Author (1)
Ovais Mehboob Ahmed Khan
Ovais Mehboob Ahmed Khan
author image
Ovais Mehboob Ahmed Khan

Ovais Mehboob Ahmed Khan is a seasoned programmer and solution architect with nearly 20 years of experience in software development, consultancy, and solution architecture. He has worked with various clients across the world and is currently working as a senior customer engineer at Microsoft. He specializes mainly in application development using .NET and OSS technologies, Microsoft Azure, and DevOps. He is a prolific writer who has written several books and articles on various technologies. He really enjoys talking about technology and has given a number of technical sessions around the world.
Read more about Ovais Mehboob Ahmed Khan

Right arrow

Avoiding finalizers

Using finalizers is not a good practice to use in .NET Core applications. Objects that use finalizers stay in memory longer and ultimately affect the application's performance.

Objects that are not required by the application at a particular point in time stay in the memory so that their Finalizer method can be called. For example, if the object is considered dead by the GC in generation 0, it will always survive in generation 1.

In .NET Core, CLR maintains a separate thread to run the Finalizer method. All the objects that contain the Finalizer method are placed into the finalization queue. Any object that is no longer required by the application is placed in the F-Reachable queue, which is then executed by the dedicated finalizer thread.

The following diagram shows an object1 object that contains a Finalizer method. The Finalizer method is placed in...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
C# 7 and .NET Core 2.0 High Performance
Published in: Apr 2018Publisher: ISBN-13: 9781788470049

Author (1)

author image
Ovais Mehboob Ahmed Khan

Ovais Mehboob Ahmed Khan is a seasoned programmer and solution architect with nearly 20 years of experience in software development, consultancy, and solution architecture. He has worked with various clients across the world and is currently working as a senior customer engineer at Microsoft. He specializes mainly in application development using .NET and OSS technologies, Microsoft Azure, and DevOps. He is a prolific writer who has written several books and articles on various technologies. He really enjoys talking about technology and has given a number of technical sessions around the world.
Read more about Ovais Mehboob Ahmed Khan