|
2014-03-11
| ||
| 17:25 | • Closed ticket [f50ff6f929]: memory command is not available with TCL_MEM_DEBUG e... artifact: b18252b808 user: dgp | |
| 17:24 | • Ticket [f50ff6f929]: 3 changes artifact: 4862e9b954 user: dgp | |
| 14:24 | • Add attachment config.log to ticket [f50ff6f929] artifact: 6f15f901e8 user: sakthivp | |
| 14:22 | • Open ticket [f50ff6f929]: memory command is not available with TCL_MEM_DEBUG ena... artifact: f7d676112c user: sakthivp | |
| 13:54 | • Closed ticket [f50ff6f929]. artifact: b1a50783a3 user: dgp | |
| 13:53 | • Ticket [f50ff6f929]: 4 changes artifact: 6d52ca41fa user: dgp | |
| 13:06 | • Pending ticket [f50ff6f929]. artifact: 46e69b8707 user: dgp | |
| 07:20 | • Add attachment Makefile.txt to ticket [f50ff6f929] artifact: 2368827437 user: sakthivp | |
| 07:19 | • New ticket [f50ff6f929] memory command is not available with TCL_MEM_DEBUG enabl... artifact: fb183cd480 user: sakthivp | |
memory command is not available with TCL_MEM_DEBUG enabled libraries
Closed / Invalidf50ff6f929119c62f9994d974a69be5e8bbf52d0Created 13 years agoUpdated 13 years ago
Descriptionplain2014-03-11 07:19:07
I compiled the Tcl libraries with TCL_MEM_DEBUG symbol by configuring using below command.
./configure --prefix=/scratch/sakthi/Tcl_8.4.9_debug --enable-symbols=all
I found a library with name libtcl8.4g.so. Then i wrote a C program which uses the debug shared object to invoke Tcl 'memory' command. The program failed to execute the 'memory' command.
C program
---------
#include <stdio.h>
#include <tcl.h>
#include <stdio.h>
#include <tcl.h>
int main()
{
int x=0;
Tcl_Interp* a;
a = Tcl_CreateInterp();
Tcl_Init(a);
Tcl_InitMemory(a);
if (a == NULL)
printf("Interpreter creation Failed \n");
x = Tcl_Eval(a,(char *)"memory info");
Tcl_DeleteInterp(a);
printf("DeleteInterpreter x=%d \n",x);
}
---------------------
Compilation flags on solaris10 server
/opt/Studio11/SUNWspro/bin/CC -L/scratch/sakthi/Tcl_8.4.9_debug/lib -ltcl8.4g -I/scratch/sakthi/Tcl_8.4.9_debug/include Tcl_inter_problem.c -o Tcl_inter_problem
----------------------
Output of the program
DeleteInterpreter x=1 // Tcl_Eval function returns 1 (TCL_ERROR), unable to execute memory command.
I have attached the Makefile which was generated by configure script.
dgpplain2014-03-11 13:06:05
We no longer support Tcl 8.4. Do you see any similar problems using Tcl 8.5.15?
dgpplain2014-03-11 13:53:59
I got curious enough to look. Your error is a simple one.
You forgot to #define TCL_MEM_DEBUG when compiling your
program. One simple way to correct this is just to add
it in your program source code:
#include <stdio.h>
#define TCL_MEM_DEBUG
#include <tcl.h>
int main()
{
int x=0;
Tcl_Interp* a;
a = Tcl_CreateInterp();
Tcl_Init(a);
Tcl_InitMemory(a);
if (a == NULL)
printf("Interpreter creation Failed \n");
x = Tcl_Eval(a,(char *)"memory info");
Tcl_DeleteInterp(a);
printf("DeleteInterpreter x=%d \n",x);
}
If you need more flexible configuration options than that,
I'll leave the use of -DTCL_MEM_DEBUG in your build machinery
as an exercise.
Now please update your Tcl. If you really, really truly
cannot leave Tcl 8.4, at least move to Tcl 8.4.20 so you stop
ignoring 9 years of bug fixes.
dgp Closed ticket [f50ff6f929].
[History diff]2014-03-11 13:54:22
sakthivpplain2014-03-11 14:22:28
After adding '#define TCL_MEM_DEBUG' i compiled the program with -ltcl8.4g. But the output of the program is same.
-----------
#include <stdio.h>
#include <tcl.h>
#include <stdio.h>
#define TCL_MEM_DEBUG
#include <tcl.h>
int main()
{
int x=0;
Tcl_Interp* a;
a = Tcl_CreateInterp();
Tcl_Init(a);
Tcl_InitMemory(a);
if (a == NULL)
printf("Interpreter creation Failed \n");
x = Tcl_Eval(a,(char *)"memory info");
Tcl_DeleteInterp(a);
printf("DeleteInterpreter x=%d \n",x);
}
----------------------
compilation
/opt/Studio11/SUNWspro/bin/CC -L/scratch/sakthi/Tcl_8.4.9_debug/lib -ltcl8.4g -I/scratch/sakthi/Tcl_8.4.9_debug/include Tcl_inter_problem.c -o
-----------------------
output of the program:
Tcl_inter_problem
DeleteInterpreter x=1
------------------------
Tcl8.6 Library
==============
I compiled the Tcl8.6 source code with TCL_MEM_DEBUG flag (attached the config.log), but there was no libtcl8.6g.so libraries. I linked the library with my program and found the same result with 8.6 libraries.
/opt/Studio11/SUNWspro/bin/CC -L/scratch/sakthi/Tcl_8.6_debug_2/lib -ltcl8.6 -I/scratch/sakthi/Tcl_8.6_debug_2/include Tcl_inter_problem.c -o Tcl_inter_problem
output
------
Tcl_inter_problem
DeleteInterpreter x=1
Can you please help me on this?
dgpplain2014-03-11 17:24:46
You must place the #define TCL_MEM_DEBUG before the *first* (why do you have more than one?) #include <tcl.h> for it to have effect.
dgp Closed ticket [f50ff6f929].
[History diff]2014-03-11 17:25:28
Log in (anonymous is fine) to add a comment.