Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2025-03-25
01:37
solves [ebc39f14d75c1cfc]: don't use command tracing for OO-objects leaf check-in: 495ffc0324 user: sebres tags: br-ebc39f14d7-oo-no-trace
01:16 • Ticket [ebc39f14d7] OO-command implicit tracing status still Open with 3 oth... artifact: ccb0466d51 user: sebres
01:14 • New ticket [ebc39f14d7]. artifact: 6e7ae8b876 user: sebres

OO-command implicit tracing

Openebc39f14d75c1cfc8cd0840f8312b45b4f744b64Created 2 years agoUpdated 2 years ago
Descriptionwiki2025-03-25 01:14:34
The command of OO-object will be always created together with a rename/delete trace, that has a lot of adverse consequences:
  1. additional alloc/free per object
  2. unneeded effort by deletion due to untrace procedure
  3. tracing of command may cause extra overhead by evaluation, and needlessly burden the invocation of object and its methods
  4. due to this retarded by design clean-up via trace (and only one refCount for cmdPtr stored in object), it may cause usage after free for deleted oPtr->command (with Tcl_DeleteCommandFromToken, if it was last reference to the time of call ObjectNamespaceDeleted)
  5. oPtr->refCount is initially 2, with further cons, like potential leaks (either trace or command isn't involved in this refCount, otherwise it'd be 3 and not 2) or dereferencing by deletion is not really "atomic" or else may be semi-finished by refCount = 1;
  6. the trace is basically not really needed, because:
    • for deletion there is deleteProc-callback that one could set directly by creating of the OO-command
    • and renaming trace is currently used only to clean oPtr->cachedNameObj (if it is therel), this can be achieved by different approach, e.g. by checking of cmdEpoch (which gets incremented by rename) inside the TclOOObjectName);

I'll provide new branch without tracing in OO.

sebres Ticket [ebc39f14d7]: 3 changes [History diff]2025-03-25 01:16:13
Log in (anonymous is fine) to add a comment.