A New Age of JVM Garbage Collectors
The great problem with memory as with a lot of things in life and life itself is that it is a finite resource there comes a time when it can run out, that’s where garbage collector come in, a lot of nowadays applications for the processors need from memory to store mid calculations there comes a time where if not erased those mid calculations will fill the memory and break the process, so a garbage collector is tasked with dealing with those pesky bits of data that aren’t needed anymore.
The simplest way to manage memory is basically doing it manually, saying of curse that you are doing the work to simplify the work of the computer, and its amazing if you do it well but it relies on you doing it well and doing the work and could also lead to problems with fragmentation reducing it awesomeness.
Automatic reference counting is another method pretty efficient but with a great flaw, that has memory leaks, so it is usually not used by its own and has the problem of fragmentation too.
Mark sweep compact is the option that java uses and for extension clojure too since it runs in the JVM, it bases of the idea of finding all the object that are actually doing something and everything else is garbage, it follows the structures and pointers marking all reachable objects, and if you are not marked you are dead you remove the corpses and try to compact the lives one as tight as possible to make space for the new ones, the really bad thing about this one is while the gc makes its thing everything is suspended an that can take time that’s why most of the time moder gc use a combination trying to level the resources that each algorithm consumes being cpu power, space or time.
Comentarios
Publicar un comentario