Skip to content
Tcl Source Code Artifact [769d407e45]
Login

Artifact [769d407e45]

Artifact 769d407e452799770450cd987d8424a1f578f7c8df11657da99aa1446c63dddb:

Ticket change [769d407e45] - Ticket [bb9129e46c99f405|bb9129e46c] <i>TCL Memory raise up and didn&#39;t come down for ever</i> status still Open with 5 other changes by dkf on 2024-05-24 08:58:19.
D 2024-05-24T08:58:19.065
J comment Recentely,I\sbuild\sa\sc++\sprogram\swith\sthe\sTCL\sInterpreter,and\sspawn\s20\sthreads\s.In\seach\sthread,I\swrite\sthe\sflowing\scode\sin\sloop\s:\r\n\r\n1.\snew\sa\sTCL\sInterpreter\r\n\r\n2.\sexecute\slots\sof\sTCL\sscript\r\n\r\n3.\sdelete\sthe\sinterpreter\s\r\n\r\n4.\scall\sTcl_FinalizeThread\sto\sfree\sthe\smemory\s\s\s\s\s\r\n\r\nAfter\sexecute\sthe\scode.the\smemory\sis\sraise\sup\sand\sdidn't\scome\sdown\sfor\sever.And\sthe\sI\scheck\sthe\scode\sof\sTCL8.6.8\s,I\sfound\sthat\sTCL\shave\stwo\stype\sof\smemory\smanagement:Thread\sLocal\sStorage\smemory\sand\sshared\smemory.After\sTcl_FinalizeThread\s\sis\scall\s,the\sTLS\smemroy\swill\stransfer\sto\sshared\smemory.and\sshareed\swill\snot\sfree\sfor\sever\s,and\sthis\swill\slead\sto\sTCL\sMemory\sraise\sup\sand\sdidn't\scome\sdown\sfor\sever\r\n\r\nMy\squestion\sis\s:\r\n\r\n1.why\sTCL\sdidn't\sfree\sthe\sshared\smemeory\sfor\sever\r\n\r\n2.Does\s\sTCL\sprovide\sany\sway\sto\sfree\sthe\sshare\smemory
J icomment It's\sa\straditional\shigh-water-mark\smemory\sallocator\s(with\sspecial\sarenas\sfor\s`Tcl_Obj`\sstructures\sand\sfor\sthe\sexecution\sstacks),\sat\sleast\sfor\ssmall\sallocations;\slarge\sallocations\sgo\sdirect\sto\swhatever\sthe\ssystem\smemory\sallocator\sis\s(i.e.,\s`malloc()`\son\sPOSIX).\sUnused\smemory\spages\swill\seventually\sget\spaged\sout\sby\sthe\sOS\sso\sit's\snot\stoo\sserious\sin\snormal\sapplications.
J login dkf
J mimetype text/x-markdown
J subsystem 41.\sMemory\sAllocation
K bb9129e46c99f405fbc6bbd9261726c05a2ffb2e
U dkf
Z b358f5ca4333d4141004b6e1b72607d8