Why is garbage col开发者_开发知识库lection rarely spoken about in languages such as Pascal and C, whereas it is very important in SML and Java?
Pascal and C don't traditionally use garbage collections. They used manual memory management instead (malloc
/free
for C and new
/dispose
in Pascal).
Garbage collection can be added in most languages that don't have them, but often with considerable expenses. An example of a garbage collector for C/C++ is the Boehm GC.
Java, on the other hand, has been designed with garbage collection from the ground up.
精彩评论