answersLogoWhite

0


Best Answer

If you define clean up in destructor garbage collector will take more time to clean up the objects and more and more objects are created in Gen 2..

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: When you define clean up destructor how does it affect garbage collector?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are destructor in java?

Destructors in Java are called finalizers. Every class can define a finalize() method that will get called automatically by the garbage-collector when an instance of the class gets garbage-collected. Finalizers are not guaranteed to get called, as the instance might never get collected.


How do you write a C plus plus program for destructor?

Class destructors define operations that will be performed whenever an object of the class falls from scope. This usually involves manually releasing any resources allocated to the object. However, by using resource handles or smart pointers, all resources will be released automatically, thus there is no need to define a destructor. The only time we really need to define a destructor is when the class is intended to be used as a polymorphic base class (has one or more virtual methods) but does not inherit a virtual destructor, in which case we must define a virtual destructor. Classes that do define or inherit a virtual destructor cannot be used polymorphically. However, by using resource handles or smart pointers to manage resources, the destructor body can be left empty. The only reason for declaring the destructor at all is simply to declare it virtual because all methods are non-virtual by default -- unless they override a virtual method of the base class (in which case they can simply be declared as overrides). The only time we need to define a non-empty destructor body is when implementing a resource handle or smart pointers, however the standard library already provides efficient implementations so, other than for educational purposes, there is no need to define our own resource handles.


Can you overload destructor for your class?

No. Classes can only have one destructor, whether you define one yourself or allow the compiler to generate one for you. The compiler-generated destructor is public by default, does not release any memory allocated to any class' member pointers, and is non-virtual, which are the three main reasons for defining your own.


Define social perception and how stereotypes affect it?

how do stereotyping affect perception


Define stability factor?

beta is defined as the rate of change of collector current (Ic) with respect to the collector leakage current (Ico) keeping beta and (VBE) constant also (IB) constant.


What does the delete operator do in addition to deallocation of memory space?

The delete operator calls the destructor of the object referenced by its operand. If the destructor is virtual, the destructor of each superclass up to the top of the inheritance hierarchy is also called, in order. If you don't define a destructor for a class, the compiler defines a default destructor that has no effect. Fundamental types (char, int, float, etc.) do not have destructors, so using delete has no other effects.As an aside: when you use inheritance, make sure to make your destructors virtual, so that objects are properly destroyed!Also note that you should not use C's free() on a pointer that you got from C++'s new, or use C++'s delete on a pointer you got from C's malloc(). These are not guaranteed to work, and mixing them might cause Big Bad Things to happen. In general, there is no reason to use malloc()/free() in C++ at all.


Define the psychological term lack of affect?

Lack of expression or emotion.


Define dangling if in terms of java?

A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.A dangling reference is less problematic in Java, because the garbage collector will eventually delete any object that is unreachable. So, even if one object has a reference to a second object, and the second has a reference to the first object, they would eventually be destroyed if they are unreachable from the objects referenced on the stack.


What does it mean in java when a constructor is undefined?

When a constructor is not define in java then the instance used in class is not optimised the value and therefore some times it generates some garbage value. By the way , When we not define a constructor then generally it not distrub the execution of the program.


How masses of bodies affect their abilities to retain heat?

define dew point?


How can you force the garbage collector to run?

You can't force it but you call System.gc(), which is a "hint" to the runtime engine that now might be a good time to run the GC. But garbage collection using this method is not guaranteed to be done immediately. there is another way to explicitly call the gc(). this method is also define in Runtime class of package java.lang. But u can not create a direct object of class Runtime like Runtime a = new Runtime(); //wrong For that u have to call the method getRuntime() which is static and it is also define in Runtime class the way to create object is Runtime run; //right run = Runtime.getRuntime(); //right now u can call the gc() through the "run " Object. like run.gc(); //right


The two attributes that define a threat in OPSEC are?

The capability of an adversary coupled with intention to affect friendly operations.