Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why has Ada no garbage collector?

I know GC wasn't popular in the days when Ada was developed and for the main use case of embedded programming it is still not a good choice.

But considering that Ada is a general purpose programming language why wasn't a partial and optional (traces only explicitly tagged memory objects) garbage collector introduced in later revisions of the language and the compiler implementations.

I simply can't think of developing a normal desktop application without a garbage collector anymore.

like image 681
Lothar Avatar asked Nov 06 '09 22:11

Lothar


People also ask

Does Ada have a garbage collector?

The Ada specification does not require automatic garbage collection, but Ada is explicitly defined to permit automatic garbage collection. Compiler vendors are free to implement it at their option.

Is garbage Collector necessary?

It is not strictly necessary. Given enough time and effort you can always translate a program that depends on garbage collection to one that doesn't.


2 Answers

Ada was designed with military applications in mind. One of the big priorities in its design was determinism. i.e. one wanted an Ada program to consistently perform exactly the same way every time, in any environment, under all operating systems... that kinda thing.

A garbage collector turns one application into two, working against one another. Java programs develop hiccups at random intervals when the GC decides to go to work, and if it's too slow about it there's a chance that an application will run out of heap sometimes and not others.

Simplified: A garbage collector introduces some variability into a program that the designers didn't want. You make a mess - you clean it up! Same code, same behavior every time.

Not that Ada became a raging worldwide success, mind you.

like image 192
Carl Smotricz Avatar answered Sep 21 '22 13:09

Carl Smotricz


Because Ada was designed for use in defense systems which control weapons in realtime, and garbage collection interferes with the timing of your application. This is dangerous which is why, for many years, Java came with a warning that it was not to be used for healthcare and military control systems.

I believe that the reason there is no longer such a disclaimer with Java is because the underlying hardware has become much faster as well as the fact that Java has better GC algorithms and better control over GC.

Remember that Ada was developed in the 1970's and 1980's at a time when computers were far less powerful than they are today, and in control applications timing issues were paramount.

like image 37
Michael Dillon Avatar answered Sep 19 '22 13:09

Michael Dillon