55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
-
-
+
+
-
+
-
+
|
might be taken. (Pros and cons)
Each object type fully controls the creation, duplication, and release of the internal rep.
However it controls only the creation of the string rep. The overall value system defines
that when it is time to release the string rep, it will be done with <b>ckfree</b>. This
implies that every string rep must be a separately <b>ckalloc</b>'d chunk of memory
and that implies a fair bit of memory management and string copying. The expense of
this is mitigated by the Copy On Write scheme that keeps the number of values that
are nothing more than copies of others down.
this is mitigated by the Copy On Write scheme that keeps down the number of values that
are nothing more than copies of others.
Offering the object type control over the release of string reps would allow for other
possibilities, where a set of values drawn from a small set of static strings might be
done without memory management. Or string reps could be substrings of other
strings kept alive via whatever means is required. This would imply relaxing the
current requirement that objPtr->bytes values are NUL-terminated.
The reference counting scheme used to manage copy on write as well as memory
management brings with it the constraing that these values are tied to a single
management brings with it the constraint that these values are tied to a single
thread at a time, and except where special care is taken that means a Tcl value
is born, lives, and dies all in one thread. Values that must pass from one thread
to another take a route through a strip representation.
to another take a route through a string representation.
|