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

Artifacts have been found at the Cave of Altamira going back 18,500 years. What can be found on the cave's walls?
What is a grammatical name?
Can someone help me with this math question plz i will appreciate it. So this is the question: some of the methods you can use to add or subtract are?.
x and y are angles on a line l forming linear pairs . if twice of x is 30 degree less than y . Find x and y .
PLEASE HELP Write the equation of the line in slope-intercept form. The equation of the line in slope-intercept form is
do drug addicts need help or punishment? why?​
Ivan wants to rent a boat and spend less than $31. The boat costs $8 per hour, and Ivan has a discount coupon for $9 off. What are the possible numbers of hours
The special job an organism plays in it's ecosystem is it's __________.
what is 6 more than -3 in integers​
If it takes 6 workers to paint a house in 48 hours how will it take 4 workers to paint the same house?