Garbage Collection

C, C++, Objective C, Swift, Forth, Fortran, Basic, Pascal, Rust, Alef, Ada (most implementations) and many other high level programming languages do not have a garbage collector. [andrea.ferro]

Forth Does Not Need Garbage Collection

Forth does not need garbage collection because transient data is pushed on the stack. So by the very nature of the language memory is automatically freed when the word which held the memory exits. You push the desired amount of memory on the stack, then call all of the words which need to access that block of memory. When everything is done it’s freed. It’s just the same as if you malloc(3c) a block on entry to a function and then call free(3c) just before you exit. Forth has the great advantage that you can’t have a memory leak if you honor the principles on which it is founded. [reginald.beardsley]

Table Of Contents

Previous topic

Fossil Distributed Version Control System

Next topic


This Page