Version 1 of Character byte size in tcl memory management

Updated 2003-03-28 20:38:04

Theo Verelst

I remember from the earlier days of tcl, when I was looking around for at least a decent interpreted language, preferably with user interface component for a HP UX (hp720) based job, for which I had made some X stuff but with quite old widgets and without much of menus, that the tcl interpreter used 4 bytes (an integer) for storing a character.

Come to write about it, I don�t know wether I gathered that would be for storing just one char in source or var, I guess I somehow assumed that was the general idea.

Anyone who knows wether that is the case at present ?

NEM - Do you mean storing a char as in

 set x a  ;# Set x to the character 'a'

?

In this case, Tcl stores a string of length 1. So, you now have the size of the Tcl_Obj structure (24 bytes?) plus the size of the string representation of that character in UTF-8, so quite a bit more than 4 bytes used now.