Index: ChangeLog =================================================================== diff -u -r0037211cd9632cbb418f9f8ca40a001a51d1598d -rd24dde11bfd2657f40bce1b656020c8fd70791d5 --- ChangeLog (.../ChangeLog) (revision 0037211cd9632cbb418f9f8ca40a001a51d1598d) +++ ChangeLog (.../ChangeLog) (revision d24dde11bfd2657f40bce1b656020c8fd70791d5) @@ -1,3 +1,24 @@ +2008-11-01 + * added command ::xotcl::finalize + + This command has the only purpose to delete all objects and classes + of an interpreter in a multi-threaded environment at a safe time. + + Background: when XOTcl is used in a threaded environment such as + for example in AOLserver, one has to take care that the deletion + of objects and classes happens in a safe environment, where the + XOTcl destructors (destroy methods) are still able to + run. Without ::xotcl::finalize the deletion happens in + Tcl_FinalizeThread(), after thread cleanup (where e.g. the + thread local storage is freed). This can lead to memory leaks in + AOLserver, which allocates e.g. some structures on demand, but + since this happens after cleanup, it will leak. A simple ns_log + in a destructor might lead to this problem. The solution is to + call ::xotcl::finalize in the "delete trace" in AOLserver (as it + happens in OpenACS). + + * some code cleanup + 2008-10-17 * handle nonposargs in method "copy" properly Index: doc/langRef.xotcl =================================================================== diff -u -r0037211cd9632cbb418f9f8ca40a001a51d1598d -rd24dde11bfd2657f40bce1b656020c8fd70791d5 --- doc/langRef.xotcl (.../langRef.xotcl) (revision 0037211cd9632cbb418f9f8ca40a001a51d1598d) +++ doc/langRef.xotcl (.../langRef.xotcl) (revision d24dde11bfd2657f40bce1b656020c8fd70791d5) @@ -113,14 +113,34 @@ with class definitions (e.g. when used in OpenACS with file watching and reloading). With <@tt>softrecreate set, it is not necessary to recreate dependent subclasses etc. -
+

Example: e.g. there is a class hierarchy A <- B <- C Without <@tt>softrecreate set, a reload of B means first a destroy of B, leading to A <- C, and instances of B are re-classed to ::xotcl::Object. When <@tt>softrecreate is set, the structure remains unchanged.

+
<@tt>::xotcl::finalize<@/tt>
+
Delete all XOTcl objects and classes and free all associated memory. +

+ This command has the only purpose to delete all objects and classes + of an interpreter in a multi-threaded environment at a safe time. +

+ Background: when XOTcl is used in a threaded environment such as + for example in AOLserver, one has to take care that the deletion + of objects and classes happens in a safe environment, where the + XOTcl destructors (destroy methods) are still able to + run. Without ::xotcl::finalize the deletion happens in + Tcl_FinalizeThread(), after thread cleanup (where e.g. the + thread local storage is freed). This can lead to memory leaks in + AOLserver, which allocates e.g. some structures on demand, but + since this happens after cleanup, it will leak. A simple ns_log + in a destructor might lead to this problem. The solution is to + call ::xotcl::finalize in the "delete trace" in AOLserver (as it + happens in OpenACS). +

+ }