Dervish [L1 ] [L2 ] is a collection of libraries and corresponding tcl bindings developed at Fermilab to support the Sloan Digital Sky Survey project.

Dervish lets you allocate, use, and deallocate memory for data structures, not just strings as is usual in tcl. A "chain" is a doubly linked list of structures. You can interactively look through a chain. Commands that load and save data often do such as chains. You can retrieve specific elements of a chain.

Dervish uses an interface to pgPlot for plotting, using fairly direct mappings to the C and Fortran interfaces.

A Dervish "vector" is a one dimensional array of floats. One can operate on all elements of a vector at once.

Dervish contains a specialized memory manager and garbage collector. Dervish memory manager can be used to replace entirely the system memory manager (malloc() and friends), or it can be used in conjunction with the system memory manager. The Dervish Memory Manager provides some degree of help to the user in the area of garbage collection. Each block allocated by Dervish memory management routines contains a unique number: its serial number. Serial numbers increase in time, thus successively allocated memory blocks will have successively larger serial numbers; this can be used to ensure that there are no memory `leaks'; blocks of allocated memory that are no longer being used (and may have been totally lost, the classic reason being that the only record of their existence having been a local variable in a subroutine).

Garbage collection can then be performed by calling an API that deallocates all memory blocks between two serial numbers (inclusively).

Dervish Memory Manager allows the user to register a call back function to the allocation of a certain serial number. When a memory block with that serial number is allocated, the registered call back function is triggered; additionally you can get a callback when a given block is freed.

Dervish Memory Management and Garbage Collection routines have both C and TCL bindings.

Source code: [L3 ]