Why in other languages ​​there is no automatic garbage collection similar to Java Garbage Collector?

What is the reason that other languages ​​do not have a garbage collector?

Why is garbage collection not built in for these other languages? Why are programmers responsible for collecting?

+3
source share
10 answers

Reasons to not have garbage collection:

  • Truly efficient collectors were not developed until 1985 1990. Languages ​​developed before this time, if efficiency was the goal, do not contain garbage collection. Examples: Ada, C, Fortran, Modula-2, Pascal.

  • Bjarne Stroustrup , , " , ". (. 2- 3- ACM .) ++ .

  • (, ) , . , , , , .

+20

" " - C#, .NET CLR .

, ++ :

  • ++ , ;

  • . C++ , ;

  • , ++ . , ( ) . , , , .NET Java.

  • Java , .NET , ++ . .

  • ++ , (, ), . , - "" GC , .

+5

( , , , , "GC " ). , GC. - " " ( ), : GC.

, GC - , . . , GC , , ; "GC ", , ( , ). , , , , . , C ++. C , , . GC , ...

, GC-less. C, ++, Forth, ... GC , . Hans Boehm GC C ++. , , GC () , "", .

, GC, , , , , (, Javacard, Java -, GC-less, GC 8 kB 512 ).

, , ( " ", - ), , - .

+5

. , C, , . , , (, , Lisp?), , , . , , , , .

+3

, , " - ", ...

GC

:

, "" . , GC .

GC

, :

  • .

, , , " " " ".

GC (, Java). , , , :

RAII Java... ?

RAII

RAII - , . , , , ++, / , , Garbage Collection.

, 2008 Java, , .

, ?

:

  • GC
  • GC reouce.
  • .

++ " ".

GC ++ RAII (. ++ - ?), RAII GC.

Ever.

+3

. GC /.

+2

, , - . , . 180 - , . GC .

, GC . - , .. - . , (- ASP.NET ).

- , GC . , GC, .

+1

, # java, , , . . (, , - ), , , ++. , , .

0

C, ++, Java # ( ). Java, # .

, , , , .

0

GC C ++ .

C/++ , , GC. , , Bell Labs; , , , - . C- - , : Bell Lab just knew that they could write safe, secure code even though the API was made from razor blades and nitroglycerin. Ideal programmers do not need network lines, and excellent programmers do not need a GC. It is a pity that there are no ideal programmers. Confidence is important, but humility prevents us from destroying ourselves.

0
source

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


All Articles