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

Ben graphed a line on a grid the slope was -3, and is passed through the point (0,4). What is the equation of the line Ben graphed ?
please help attachmet
A box measures 5 inches long x 9 inches deep x 11 inches high. What's its volume in cubic inches?
Help me to answer this pls​
Caroline asked several people about their age and much television they watch each night. She recorded the data in a scatter plot.
After making a change to a program and attempting to re-run it, you get an error message stating that changes are not allowed. What can you do to clear the erro
BIBLE The other officials in Darius's kingdom were jealous of Daniel because he prayed to his God. TrueFalse
Where do most movements happen in the Earth's crust?
Yk, this has been awhile since I’ve asked questions on brainly. I really appreciate you random ppl answering questions. Some people really struggle doing this s
Answer these i have all the answers already just testing Tyyyyy <3 BRAINLIEST GIVEN