Tcl won't compile with 'TCL_MEM_DEBUG' enabled
Closed / Fixed224384ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-12-04 14:53:35
It looks as if when the new 'AttemptAlloc' code was added, no-one tested whether Tcl 8.4 would compile with the mem debug flag enabled, even though code involving that flag was modified... ;-) There is a typo in tcl.h: # define attemptckalloc(x) Tcl_AttempDbCkalloc(x, __FILE__, __LINE__) should be 'Attempt' not 'Attemp' and the two functions 'Tcl_AttemptDbCkrealloc' and 'Tcl_AttemptDbCkalloc' are in the '#else' rather than '#if' branch of '#if TCL_MEM_DEBUG' so they are not seen and cause link errors....
vincentdarleyplain2000-12-04 22:09:48
Even when I've fixed the above bugs, I can't execute anything on the command-line in tclsh, without a 'low guard failed' panic. (However I have patched the core in various ways, so this could be my fault). In any case, someone should try to run Tcl's test suite with TCL_MEM_DEBUG enabled.
nobodyplain2000-12-06 19:01:43
Fixing the typo above, and adding the following two functions to the first half (the '#if' not '#else' half) of tclCkalloc.c will allow Tcl to work again.
char *
Tcl_AttemptDbCkrealloc(ptr, size, file, line)
char *ptr;
unsigned int size;
char *file;
int line;
{
char *result;
result = (char *) Tcl_DbCkrealloc(ptr, size, file, line);
return result;
}
char *
Tcl_AttemptDbCkalloc(size, file, line)
unsigned int size;
char *file;
int line;
{
char *result;
result = (char *) Tcl_DbCkalloc(size, file, line);
return result;
}
ericmplain2000-12-07 04:27:54
Thanks for pointing out this oversight. I fixed the typo and added TCL_MEM_DEBUG versions of the functions Tcl_AttemptDbCkalloc and Tcl_AttemptDbCkrealloc, based on the TCL_MEM_DEBUG versions of Tcl_DbCkalloc and Tcl_DbCkrealloc (rather than copying the non-TCL_MEM_DEBUG versions as suggested in another comment, since those versions did not have the extra bits needed to provide the memory debugging facilities). This fix is checked in to the CVS repository, and will go out with Tcl 8.4a3. Eric Melski The Other Tcl Guy Interwoven, Inc. ericm at interwoven.com
dgp Ticket [224384ffff]: 3 changes
[History diff]2001-04-05 06:52:44
Log in (anonymous is fine) to add a comment.