Gc using type information

Does anyone know a GC algorithm that uses type information to allow incremental collection, optimized collection, parallel collection, or some other nice feature?

By type of information, I mean real semantics. Let me give you an example: suppose we have an OO style class with list support methods that hide the view. When an object becomes inaccessible, the collector can simply run a list that removes all nodes. He knows that they are now unavailable due to encapsulation. He also knows that there is no need to perform a general node scan for pointers, because he knows that all nodes are of the same type.

Obviously, this is a special case and is easily handled by destructors in C ++. The real question is whether there is a way to analyze the types used in the program and direct the collector to use the information received in the interests. I think you would call it a type garbage collector.

+4
source share
2 answers

The idea of ​​at least using containers for garbage collection is somehow not new, but in Java you cannot even assume that the container contains a single reference to the objects inside it, so your approach will not work in this context.

Here are some links. One of them is designed to detect leaks, and the other (from my research team) is concerned with improving cache locality.

http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?arnumber=4814126 http://www.cs.umass.edu/~emery/pubs/06-06.pdf

You can visit Richard Jones for an extensive bibliography of garbage libraries for more information or ask people on the gc-list .

+5
source

I do not think this has anything to do with a particular algorithm.

When the GC calculates a graph of object relationships, the information that the Collection object is solely responsible for these list items is implicitly present in the graph if the compiler was good enough to retrieve it.

Regardless of the GC algorithm chosen: the information is more dependent on how the compiler / runtime will extract this information.

Also, I would avoid C and C ++ with GC. Because of the arithmetic of pointers, aliases, and the ability to point inside an object (a reference to a data element or in an array), it is incredibly difficult to perform accurate garbage collection in these languages. They were not created for this.

0
source

Source: https://habr.com/ru/post/1335846/


All Articles