How we free the memory in C#.NET.

Answer Posted / prashanth s

Actually the freeing of the memory is done by the CLR
automatically by calling the garbage collection routine.
But the declared objects by the user can be deallocated
manually by using dispose function in the class by
implementing IDisposable interface in the object class.
Otherwise it can also be done by implementing a destructor
in the class, as the destructor defined will help
deallocating the object allocation after the usage of the
object gets over, i.e the object is not used anywhere else
in the program.

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does bitwise xor work?

669


What does console writeline do?

701


Will the following code compile and run?

756


What is data hiding in c#?

695


Is array passed by reference in c#?

761


List out the differences between array and arraylist in c#?

731


The int maps to which C# keyword in .NET type?

860


What is deferred execution in c#?

732


What is c# in asp net?

695


Explain the functionalities of satellite assembly?

755


Is inheritance possible in c sharp?

864


Explanation on Generic?

758


How do you pass reference parameters in c#?

674


What is the console on a mac?

711


What is deadly diamond problem?

775