Language - Garbage Collector (GC)

Card Puncher Data Processing

About

Language that have a garbage collector allows you to create as many variable (objects) as you want and you don't have to worry about destroying them. Their runtime environment deletes objects when it determines that they are no longer being used. This process is called garbage collection.

How does the garbage collector know that a variable’s storage can be reclaimed?

The basic idea is that every package-level variable, and every local variable of each currently active function, can potentially be the start or root of a path to the variable in question, following pointers and other kinds of references that ultimately lead to the variable. If no such path exists, the variable has become unreachable, so it can no longer affect the rest of the computation.

Example in Go

  • When g returns, the variable *y becomes unreachable and can be recycled.
      
func g() {
    y := new( int)
    *y = 1
}
  • conversely, x must be heap-allocated because it is still reachable from the variable global after f has returned, despite being declared as a local variable; we say x escapes from f.
var global *int 

func f() { 
        var x int  x = 1
        global = &x 
}

Documentation / Reference





Discover More
Card Puncher Data Processing
Code design - (Connection|Session)

During the use of a product, a session or connection is a execution context that holds identification data (if any) and group actions (such as interaction or transaction) that take place within...
Card Puncher Data Processing
Go

has: garbage collection, a package system, first-class functions, lexical scope, a system call interface, and immutable strings in which text is generally encoded in UTF-8. But it has...
Card Puncher Data Processing
JMeter - Load Development LifeCycle

JMeter can download the relevant resources but it does not process the HTML and execute any Javascript functions. GUI The GUI console is for: script development and debugging only. for small...
Jconsole Memory Chart
JVM - Memory (The Heap)

The JVM memory consists of the following segments: Heap Memory, which is the storage for Java objects Non-Heap Memory, which is used by Java to store loaded classes and other meta-data JVM code...
Eclipse Oepe Junit Library
Java - JUnit

Written by Erich Gamma (of Design Patterns fame) and Kent Beck (creator of XP methodology) A simple framework to write and run repeatable tests JUnit features include: Assertions for testing expected...
Java Conceptuel Diagram
Java - Java Virtual Machine (JVM|Java)

Ie the java executable: Different JVM exist and are embedded/available in a image Options that: begin with -X are non-standard (not guaranteed to be supported on all VM implementations), and are...
Java Conceptuel Diagram
Java - Object (instance of a class)

An java/lang/Objectobject: stores its state in fields and exposes its behaviour through methods (functions in some programming languages). Methods operate on an object's internal state and serve...
Jconsole Memory Tab
What is JConsole? The standard JMX Client

JConsole is a JMX client (ie Its' as jmx graphical tool for monitoring a Java virtual machine) Its full name is Java Monitoring and Management Console. It: is included with the Java SE platform (version...
Card Puncher Data Processing
What is the Heap Memory?

The heap is a chunk of memory where the variables or functions are stored during run time. A garbage collector manages the heap if present in the language features. The heap has a data structure called...



Share this page:
Follow us:
Task Runner