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 whether 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 whether 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.
TV Sort of what I meant, but I remember something about string being not stored very efficiently for instance in a text widget for reasons of tags and labels, which is often fine, of course.
And also when we store a list, how much overhead is there on top of the actual characters which make up for an uncompiled or uncompressed list was the line of thinking.
Lars H: The Compact data storage page was set up for discussions of how to compactly store data. The related Measuring memory usage page contains some scripts that one can use to measure how much memory is being used for storing various kinds of data.