GSoC Idea: Garbage Collection for Tcl Values

Garbage Collection for Tcl Values

Currently, memory allocated by the interpreter for Tcl values (Tcl_Objs) is reserved for recycling after the objects are destroyed; the memory is never freed until the interpreter exits (the “high-water-mark” model). This is fine if the volume of data your program handles is low and steady for the life of the interpreter or if the interpreter is relatively short-lived, but if a persistent program handles spikes of data volume, a very large percentage of the computer's RAM can be stuck in a reserved state: neither in use nor available for use by other non-object-creating actions of the language, not to mention out of reach of all other processes on the computer.

The objective of this project would be to write a garbage collector for unused Tcl objects. Memory reserved for Tcl objects would be periodically examined and excess memory freed. This would lead to Tcl making more efficient use of computer resources, this efficiency would complement Tcl's other strengths: its otherwise superb stability and economy.

A general discussion of the problem can be found here , and some proposed solutions are here .

Benefits for the student: learn about memory management and garbage collection, one of the most challenging fields for programmers.

Benefits for Tcl: Tcl would become more usable in a wide range of demanding usages, in the coming era of terabyte-scale data sets. Since just about all of the major dynamic languages suffer from similar limitations, Tcl would instantly distinguish itself as the superior choice in this field.