yym:src/otcl(140): otclsh % Class B B % B p1 couldn't find result of alloc % B p2 couldn't find result of alloc % B p3 p3 % B p0 p0
#0 0x4011378d in __libc_free (mem=0xbffed744) at malloc.c:2861 #1 0x804a84b in AutoLoaderDP (cd=0xbffed744) at otcl.c:492 #2 0x804aa35 in RemoveMethod (methods=0x80fc514, nm=0x8100920 "1", cd=0x80fc4c0) at otcl.c:571 #3 0x804c9e0 in OTclCInstProcMethod (cd=0x80fc4c0, in=0x8099f90, argc=7, argv=0xbfff00f4) at otcl.c:1769 #4 0x804a674 in OTclDispatch (cd=0x80fc4c0, in=0x8099f90, argc=5, argv=0xbfff0144) at otcl.c:421 #5 0x804e523 in TclInvokeStringCommand ()This does not appear to be critical for ns, because it does not uses autoloading.
--- otcl.c~ 1998/09/07 18:53:43 +++ otcl.c 1999/05/13 23:30:13 @@ -1,6 +1,6 @@ /* -*- Mode: c++ -*- * - * $Id: CHANGES.html,v 1.49 2005/10/02 21:52:06 tom_henderson Exp $ + * $Id: CHANGES.html,v 1.49 2005/10/02 21:52:06 tom_henderson Exp $ * * Copyright 1993 Massachusetts Institute of Technology * @@ -1522,7 +1522,8 @@ if (result != TCL_OK) return result; obj = OTclGetObject(in, argv[4]); - if (obj == 0) OTclErrMsg(in, "couldn't find result of alloc", TCL_STATIC); + if (obj == 0) + return OTclErrMsg(in, "couldn't find result of alloc", TCL_STATIC); (void)RemoveInstance(obj, obj->cl); AddInstance(obj, cl);
In AddMethod(), procedures are now created as ::otcl::pn where n is a running number. The deleteproc of the created procedure (OTclDeleteProc) now uses Tcl_FindCommand() to delete the procedure from tcl if it still exists.
Some simple experiments show that the impact on speed and memory is small.