It doesn't, with rare exceptions.
[Details.]
TCT takes memory leaks [ref] very seriously. Few ever escape into a release, and few known ones survive long.
However, there are at least an order of magnitude more perceived memory leaks. These result mainly from two causes:
An example of what I mean by an application-level memory leak is a failure to clean up such Tcl global variables as the token the http package returns from a getURL invocation.
[More explanation.]
[Pertinent posts [L1 ] [L2 ] by tclguy on Tcl's allocator, high-water marking, ...]
EKB 12 Mar 2006 - I have two memory-related questions:
Lars H: As I recall it, there are at least two places where compiled regular expressions are stored. One is in the Tcl_Obj, and that goes away when the Tcl_Obj does or changes representation. The other is that the regular expression compiler maintains a cache of recently compiled regexps and their compiled form; I think this cache is limited to 20-or-so elements. I don't know if there are any others.
I ask because I'm debugging a tough memory leak, and these are two prime culprits.
If this is the wrong place to put such questions, please send me to the right place. Thanks!
Also of interest: