answersLogoWhite

0

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

User Avatar

Wiki User

17y ago

What else can I help you with?

Continue Learning about Engineering

What statement instructs a program to run the garbage collector?

In the case of the Java language, you can use the command:System.gc();Note that this should be interpreted as a suggestion to run the garbage collector; there is no guarantee that it will run immediately.


How do you write a Program on garbage collector in java?

Garbage collection is an operation that happens automatically in Java. We cannot write programs to perform them. All we can do is call the system's implementation of the Garbage collector and hope that it would execute. "Runtime.gc();" Place the above piece of code in your code, if you want to invoke the garbage collector. Invoking the runtime's implementation of the gc does not guarantee the execution of the garbage collector. It may or may not run. The JVM decides on that.


Memorymically and and not reclaming it when it is no longer it is needed in java there is no such problem as there is as garbage collector what is it?

I guess you want to talk about the garbage collector feature that Java has. The garbage collector is an automated program that the Java virtual machine would run once in a while. This program would clean up unused memory to ensure that there is enough memory available for the programs. you can invoke the garbage collector by calling the system.gc() method but this does not guarantee an invocation of the garbage collector. the JVM may or may not call the GC when we invoke it...


In c garbage collector?

No.


How can someone get a job as a garbage collector in Philadelphia?

yes, it is

Related Questions

What statement instructs a program to run the garbage collector?

In the case of the Java language, you can use the command:System.gc();Note that this should be interpreted as a suggestion to run the garbage collector; there is no guarantee that it will run immediately.


How do you write a Program on garbage collector in java?

Garbage collection is an operation that happens automatically in Java. We cannot write programs to perform them. All we can do is call the system's implementation of the Garbage collector and hope that it would execute. "Runtime.gc();" Place the above piece of code in your code, if you want to invoke the garbage collector. Invoking the runtime's implementation of the gc does not guarantee the execution of the garbage collector. It may or may not run. The JVM decides on that.


Memorymically and and not reclaming it when it is no longer it is needed in java there is no such problem as there is as garbage collector what is it?

I guess you want to talk about the garbage collector feature that Java has. The garbage collector is an automated program that the Java virtual machine would run once in a while. This program would clean up unused memory to ensure that there is enough memory available for the programs. you can invoke the garbage collector by calling the system.gc() method but this does not guarantee an invocation of the garbage collector. the JVM may or may not call the GC when we invoke it...


In c garbage collector?

No.


How garbage collector works on anonymous class in java?

about the garbage collector it is in java and it is mainly responsible for dynamic memory manegement


Who performs the garbage collection?

A garbage truck. In computer programming, a process known as the garbage collector.


What actors and actresses appeared in The Garbage Collector - 2010?

The cast of The Garbage Collector - 2010 includes: Justin Huen Jamie Wollrab


How much does a garbage collector make in Orlando fl?

In Orlando, Florida, the average annual income for a garbage collector is $23,000. The average annual income for a garbage collector in Jackson, Tennessee is $25,000.


What is mean by garbage?

Garbage collected means that the memory used by an object has been reclaimed by the garbage collector.


How do you release memory in VB.NET?

Memory management (including releasing memory) is always handled by the Garbage Collector. Generally you would allow the garbage collector to run automatically.In some situations you may want to ask the garbage collector to collect sooner. In these cases you can call System.GC.Collect(). You can also implement the IDisposable interface on any classes that require special handling by the garbage collector, such as releasing database connections, file handlers or COM objects.The garbage collector does not manage COM objects. If you are working with COM objects, I recommend you read the following article:Beyond (COM) Add Reference: Has Anyone Seen the Bridge?http://msdn.microsoft.com/en-us/library/ms973274.aspx


What is mean by garbage collected?

Garbage collected means that the memory used by an object has been reclaimed by the garbage collector.


What do you call the person who picks up your trash cans?

Garbage collector...