chessacs9827 chessacs9827
  • 17-07-2019
  • Computers and Technology
contestada

I am making a java application, and I need to forcethe garbage collection, how can I

achieve that, if not why?

Respuesta :

mominetti
mominetti mominetti
  • 22-07-2019

Answer:

Hi!

  1. Runtime objectRuntime = Runtime.getRuntime();
  2. objectRuntime.gc();

Explanation:

First, you have to create an instance of a Java Runtime object. (see the first step of the answer).

Then, after creating the instance of Runtime object you have to invoke gc() method of the Runtime class. (see the second step of the answer).

Answer Link

Otras preguntas

Quien es Simon Bolívar
What are the three ways in which atoms can interact with one another with respect to their electrons?
why did the founders create a weak national government?
Which of the following is an example of a complex sentence? A.) I want to go to sleep, but the little puppy wants to go outside. B.) Some people use social
Help! How would I solve this? w+4/w-9? How do I find the values for this?
The internal lining of the cardiovascular system is formed by what tissue?
What is the slope of the line whose function f satisfies f(−2)=1  and  f(5)=−10?
Stan cut a wooden plank into 4 peices. Each peice is 18 inches long.how long was the plank before stan cut it
Leila started a savings account to buy a new bike. She started with some money her grandmom gave her and added the same amount each week from her babysitting ea
the perimeter of a rectangle is 62 meters. if the width were doubled and the length were increased by 21 meters, the perimeter would be 120 meters. what are the