What is a soft link?

In Java® coding, links are constantly carried out to objects, strings and variables, even if the programmer does not know about these links. These links communicate directly with the garbage collector, which is a function that collects unnecessary information and throws it out of no memory. By default, all links are strong links and are set without any encoding, which means that they are not released by garbage collectors. The soft link allows you to throw away the data. This is a medium reference for all inhuman links. The programmer does not have to write a reference order; The link is carried out automatically and is a strong link by default. This means that data from the link cannot be discarded because they are associated with integral objects needed for the entire script.

, however, must be discarded because they otherwise take up a lot of memory. For example, if a programmer creates a script in which serial numbers are used or collected or created by other temporary information, holding these inThe formation becomes harmful. The Java® program would refuse to throw away the information even if it is unnecessary, and the script would need more and more memory to operate.

By entering a string or section as a soft link that needs to be placed in coding, it tells the garbage collector that the data can be released. After release, the string or section will read as "null". Depending on its setting, the garbage collector decides when the data should be thrown away.

There are three non -voltable links: Soft references, weak reference and phantom link. The weak link is the weakest and its data is gone. Soft links that are best for scripts where temporary data can be used several times are another in line. The link to Phantom is almost automatically discarded in a second and should be used moderately.

time The soft reference time usually remains depends on the amount of memory on the computer. If the memory is full, garbage collector first destroys all weak links. When all weak links are away, and if the memory still needs to clean data, soft links will be evaluated.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?