diff options
author | dkf <dkf@noemail.net> | 2009-06-18 09:41:24 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2009-06-18 09:41:24 (GMT) |
commit | 4045562e2ab06ea16a7c2fc31b4a0d7565da0cbb (patch) | |
tree | 7145a35ee01103f7cbd6ba44dd6c5a4f718539ae /generic/tclCkalloc.c | |
parent | a68a0bd4205866b74c19fbc79def68a2149e486d (diff) | |
download | tcl-4045562e2ab06ea16a7c2fc31b4a0d7565da0cbb.zip tcl-4045562e2ab06ea16a7c2fc31b4a0d7565da0cbb.tar.gz tcl-4045562e2ab06ea16a7c2fc31b4a0d7565da0cbb.tar.bz2 |
Apply patch from [Bug 988703]. Many thanks to Joe Mistachkin for development.
FossilOrigin-Name: ab1f2ddc32f12e5fe6896b8aaa65b2ac94413285
Diffstat (limited to 'generic/tclCkalloc.c')
-rw-r--r-- | generic/tclCkalloc.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 2cbff69..9a3b4e3 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -14,7 +14,7 @@ * * This code contributed by Karl Lehenbauer and Mark Diekhans * - * RCS: @(#) $Id: tclCkalloc.c,v 1.35 2009/02/27 23:03:41 nijtmans Exp $ + * RCS: @(#) $Id: tclCkalloc.c,v 1.36 2009/06/18 09:41:26 dkf Exp $ */ #include "tclInt.h" @@ -803,6 +803,7 @@ MemoryCmd( const char *argv[]) { const char *fileName; + FILE *fileP; Tcl_DString buffer; int result; @@ -856,6 +857,26 @@ MemoryCmd( init_malloced_bodies = (strcmp(argv[2],"on") == 0); return TCL_OK; } + if (strcmp(argv[1],"objs") == 0) { + if (argc != 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " objs file\"", NULL); + return TCL_ERROR; + } + fileName = Tcl_TranslateFileName(interp, argv[2], &buffer); + if (fileName == NULL) { + return TCL_ERROR; + } + fileP = fopen(fileName, "w"); + if (fileP == NULL) { + Tcl_AppendResult(interp, "cannot open output file", NULL); + return TCL_ERROR; + } + TclDbDumpActiveObjects(fileP); + fclose(fileP); + Tcl_DStringFree(&buffer); + return TCL_OK; + } if (strcmp(argv[1],"onexit") == 0) { if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], |