I have code which embeds a tcl interpreter in my c++ program. When running with valgrind it shows a bunch of possible memory leaks from the TCL interpreter. I am using Tcl_DeleteInterp(interp); to clean up the interpreter before exiting the program. I'm curious if these leaks should be worried about or not.
Main file:
#include <tcl.h>
int main(int argc, char* argv[]) {
// Initialize Tcl interpreter
Tcl_Interp* interp = Tcl_CreateInterp();
// Clean up Tcl interpreter
Tcl_DeleteInterp(interp);
return 0;
}
Compilation Command:
g++ -g main2.cpp -o test -ltcl
Valgrind Command:
valgrind --tool=memcheck --log-file=memcheck.txt --leak-check=full --verbose --track-origins=yes ./test
Valgrind Output:
--2365686-- Valgrind options:
--2365686-- --tool=memcheck
--2365686-- --log-file=memcheck.txt
--2365686-- --leak-check=full
--2365686-- --verbose
--2365686-- --track-origins=yes
--2365686-- Contents of /proc/version:
--2365686-- Linux version 4.18.0-553.44.1.el8_10.x86_64 ([email protected]) (gcc version 8.5.0 20210514 (Red Hat 8.5.0-24) (GCC)) #1 SMP Wed Mar 5 10:48:41 EST 2025
--2365686--
--2365686-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-ssse3-avx-avx2-bmi-f16c-rdrand-rdseed
--2365686-- Page sizes: currently 4096, max supported 4096
--2365686-- Valgrind library directory: /usr/libexec/valgrind
--2365686-- Reading syms from ~/test
--2365686-- Reading syms from /usr/lib64/ld-2.28.so
--2365686-- Warning: cross-CU LIMITATION: some inlined fn names
--2365686-- might be shown as UnknownInlinedFun
--2365686-- Reading syms from /usr/libexec/valgrind/memcheck-amd64-linux
--2365686-- object doesn't have a dynamic symbol table
--2365686-- Scheduler: using generic scheduler lock implementation.
--2365686-- Reading suppressions file: /usr/libexec/valgrind/default.supp
==2365686== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-2365686-by-user
==2365686== embedded gdbserver: writing to /tmp/vgdb-pipe-to-vgdb-from-2365686-by-user
==2365686== embedded gdbserver: shared mem /tmp/vgdb-pipe-shared-mem-vgdb-2365686-by-user
==2365686==
==2365686== TO CONTROL THIS PROCESS USING vgdb (which you probably
==2365686== don't want to do, unless you know exactly what you're doing,
==2365686== or are doing some strange experiment):
==2365686== /usr/libexec/valgrind/../../bin/vgdb --pid=2365686 ...command...
==2365686==
==2365686== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==2365686== /path/to/gdb ./test
==2365686== and then give GDB the following command
==2365686== target remote | /usr/libexec/valgrind/../../bin/vgdb --pid=2365686
==2365686== --pid is optional if only one valgrind process is running
==2365686==
--2365686-- REDIR: 0x4004400 (ld-linux-x86-64.so.2:strlen) redirected to 0x580d2e42 (???)
--2365686-- REDIR: 0x4002d80 (ld-linux-x86-64.so.2:index) redirected to 0x580d2e5c (???)
--2365686-- Reading syms from /usr/libexec/valgrind/vgpreload_core-amd64-linux.so
--2365686-- Reading syms from /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so
==2365686== WARNING: new redirection conflicts with existing -- ignoring it
--2365686-- old: 0x04004400 (strlen ) R-> (0000.0) 0x580d2e42 ???
--2365686-- new: 0x04004400 (strlen ) R-> (2007.0) 0x04c42300 strlen
--2365686-- REDIR: 0x4002fb0 (ld-linux-x86-64.so.2:strcmp) redirected to 0x4c434c0 (strcmp)
--2365686-- REDIR: 0x4002760 (ld-linux-x86-64.so.2:mempcpy) redirected to 0x4c46ff0 (mempcpy)
--2365686-- Reading syms from /usr/lib64/libtcl8.6.so
--2365686-- Reading syms from /usr/lib64/libstdc++.so.6.0.25
--2365686-- Reading syms from /usr/lib64/libm-2.28.so
--2365686-- Reading syms from /usr/lib64/libgcc_s-8-20210514.so.1
--2365686-- Reading syms from /usr/lib64/libc-2.28.so
==2365686== WARNING: new redirection conflicts with existing -- ignoring it
--2365686-- old: 0x05bd8f50 (memalign ) R-> (1011.0) 0x04c40d9e memalign
--2365686-- new: 0x05bd8f50 (memalign ) R-> (1017.0) 0x04c41527 aligned_alloc
==2365686== WARNING: new redirection conflicts with existing -- ignoring it
--2365686-- old: 0x05bd8f50 (memalign ) R-> (1011.0) 0x04c40d9e memalign
--2365686-- new: 0x05bd8f50 (memalign ) R-> (1017.0) 0x04c413bd aligned_alloc
==2365686== WARNING: new redirection conflicts with existing -- ignoring it
--2365686-- old: 0x05bd8f50 (memalign ) R-> (1011.0) 0x04c40d9e memalign
--2365686-- new: 0x05bd8f50 (memalign ) R-> (1017.0) 0x04c41527 aligned_alloc
==2365686== WARNING: new redirection conflicts with existing -- ignoring it
--2365686-- old: 0x05bd8f50 (memalign ) R-> (1011.0) 0x04c40d9e memalign
--2365686-- new: 0x05bd8f50 (memalign ) R-> (1017.0) 0x04c413bd aligned_alloc
==2365686== WARNING: new redirection conflicts with existing -- ignoring it
--2365686-- old: 0x05bd8f50 (memalign ) R-> (1011.0) 0x04c40d9e memalign
--2365686-- new: 0x05bd8f50 (memalign ) R-> (1017.0) 0x04c41527 aligned_alloc
==2365686== WARNING: new redirection conflicts with existing -- ignoring it
--2365686-- old: 0x05bd8f50 (memalign ) R-> (1011.0) 0x04c40d9e memalign
--2365686-- new: 0x05bd8f50 (memalign ) R-> (1017.0) 0x04c413bd aligned_alloc
--2365686-- Reading syms from /usr/lib64/libdl-2.28.so
--2365686-- Reading syms from /usr/lib64/libz.so.1.2.11
--2365686-- Reading syms from /usr/lib64/libpthread-2.28.so
--2365686-- REDIR: 0x5bdd460 (libc.so.6:memmove) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
==2365686== Preferring higher priority redirection:
--2365686-- old: 0x05be4800 (__memcpy_avx_unalign) R-> (2018.0) 0x04c44700 __memcpy_avx_unaligned_erms
--2365686-- new: 0x05be4800 (__memcpy_avx_unalign) R-> (2018.1) 0x04c46030 memmove
--2365686-- REDIR: 0x5bdc680 (libc.so.6:strncpy) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdda40 (libc.so.6:strcasecmp) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdbdf0 (libc.so.6:strcat) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdc710 (libc.so.6:rindex) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdf210 (libc.so.6:rawmemchr) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5c23420 (libc.so.6:wmemchr) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5c22d40 (libc.so.6:wcscmp) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdd690 (libc.so.6:mempcpy) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdd3c0 (libc.so.6:bcmp) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdc5e0 (libc.so.6:strncmp) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdbf00 (libc.so.6:strcmp) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdd590 (libc.so.6:memset) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5c22cc0 (libc.so.6:wcschr) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdc4d0 (libc.so.6:strnlen) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdc040 (libc.so.6:strcspn) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bddae0 (libc.so.6:strncasecmp) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdbfb0 (libc.so.6:strcpy) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bddd20 (libc.so.6:memcpy@@GLIBC_2.14) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5c247c0 (libc.so.6:wcsnlen) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdc790 (libc.so.6:strpbrk) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdbe80 (libc.so.6:index) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdc450 (libc.so.6:strlen) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5be3d80 (libc.so.6:memrchr) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bddb80 (libc.so.6:strcasecmp_l) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdd330 (libc.so.6:memchr) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5c22e90 (libc.so.6:wcslen) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdca50 (libc.so.6:strspn) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdd9b0 (libc.so.6:stpncpy) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdd920 (libc.so.6:stpcpy) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdf2a0 (libc.so.6:strchrnul) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bddc20 (libc.so.6:strncasecmp_l) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5c234b0 (libc.so.6:wmemcmp) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5c88cb0 (libc.so.6:__memcpy_chk) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5bdd250 (libc.so.6:strstr) redirected to 0x4a3277b (_vgnU_ifunc_wrapper)
--2365686-- REDIR: 0x5beaa30 (libc.so.6:__strrchr_avx2) redirected to 0x4c41c90 (rindex)
--2365686-- REDIR: 0x5bd81e0 (libc.so.6:malloc) redirected to 0x4c3910f (malloc)
--2365686-- REDIR: 0x5be77f0 (libc.so.6:__strcmp_avx2) redirected to 0x4c43380 (strcmp)
--2365686-- REDIR: 0x5be80e0 (libc.so.6:__strlen_avx2) redirected to 0x4c421e0 (strlen)
--2365686-- REDIR: 0x5be97b0 (libc.so.6:__strncmp_avx2) redirected to 0x4c42990 (strncmp)
--2365686-- REDIR: 0x5be4080 (libc.so.6:__memchr_avx2) redirected to 0x4c43560 (memchr)
--2365686-- REDIR: 0x5be73c0 (libc.so.6:__strchr_avx2) redirected to 0x4c41e70 (index)
--2365686-- REDIR: 0x5be7600 (libc.so.6:__strchrnul_avx2) redirected to 0x4c46b20 (strchrnul)
--2365686-- REDIR: 0x5be47e0 (libc.so.6:__mempcpy_avx_unaligned_erms) redirected to 0x4c46c30 (mempcpy)
--2365686-- REDIR: 0x5be4800 (libc.so.6:__memcpy_avx_unaligned_erms) redirected to 0x4c46030 (memmove)
--2365686-- REDIR: 0x5bd8870 (libc.so.6:free) redirected to 0x4c3c459 (free)
--2365686-- REDIR: 0x5be55f0 (libc.so.6:__stpcpy_avx2) redirected to 0x4c45840 (stpcpy)
--2365686-- REDIR: 0x5bd9010 (libc.so.6:calloc) redirected to 0x4c408d9 (calloc)
--2365686-- REDIR: 0x5be5340 (libc.so.6:__memset_avx2_unaligned_erms) redirected to 0x4c45f20 (memset)
--2365686-- REDIR: 0x5be7d50 (libc.so.6:__strcpy_avx2) redirected to 0x4c42330 (strcpy)
--2365686-- REDIR: 0x5be4360 (libc.so.6:__memcmp_avx2_movbe) redirected to 0x4c45700 (bcmp)
--2365686-- REDIR: 0x5b737e0 (libc.so.6:__strstr_sse2_unaligned) redirected to 0x4c47160 (strstr)
--2365686-- REDIR: 0x5c89210 (libc.so.6:__strcpy_chk) redirected to 0x4c46b90 (__strcpy_chk)
--2365686-- REDIR: 0x5bd8af0 (libc.so.6:realloc) redirected to 0x4c40af3 (realloc)
--2365686-- REDIR: 0x5bdcf60 (libc.so.6:__GI_strstr) redirected to 0x4c471d0 (__strstr_sse2)
--2365686-- REDIR: 0x5be8260 (libc.so.6:__strncasecmp_avx2) redirected to 0x4c42d10 (strncasecmp)
--2365686-- Reading syms from /usr/lib64/libnss_files-2.28.so
--2365686-- Reading syms from /usr/lib64/libnss_sss.so.2
--2365686-- Discarding syms at 0x139077b0-0x1390dd32 in /usr/lib64/libnss_files-2.28.so (have_dinfo 1)
--2365686-- Discarding syms at 0x13b19b80-0x13b20126 in /usr/lib64/libnss_sss.so.2 (have_dinfo 1)
==2365686==
==2365686== HEAP SUMMARY:
==2365686== in use at exit: 455,044 bytes in 41 blocks
==2365686== total heap usage: 127 allocs, 86 frees, 546,384 bytes allocated
==2365686==
==2365686== Searching for pointers to 41 not-freed blocks
==2365686== Checked 398,464 bytes
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 13 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F788CB: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F1A7F6: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94596: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 14 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F12C87: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F1A805: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94596: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 15 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F12CCA: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F1A805: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94596: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 16 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F7B93F: Tcl_GetThreadData (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F9EB39: Tcl_InitNotifier (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F5B763: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94596: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 17 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F586B6: Tcl_CreateNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F58DA8: TclGetNamespaceForQualName (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F59653: Tcl_FindNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15CB3: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94D1E: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 18 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F586B6: Tcl_CreateNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F58DA8: TclGetNamespaceForQualName (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F59653: Tcl_FindNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15CB3: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94D26: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 19 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F06741: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F30FC1: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F0761D: Tcl_DictObjPut (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15DA2: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94D2E: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 20 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E8F8B1: Tcl_CreateObjCommand (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94562: Tcl_NRCreateCommand (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15DDB: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94D2E: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 21 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F586B6: Tcl_CreateNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F58DA8: TclGetNamespaceForQualName (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F59653: Tcl_FindNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15CB3: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94D36: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 22 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E8F8B1: Tcl_CreateObjCommand (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94562: Tcl_NRCreateCommand (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15DDB: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94D3E: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 23 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F586B6: Tcl_CreateNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F58DA8: TclGetNamespaceForQualName (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F59653: Tcl_FindNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15CB3: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94D46: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 24 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E8F8B1: Tcl_CreateObjCommand (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94EBE: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 25 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F7C48E: TclpRealloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E9999B: Tcl_Realloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F590A3: Tcl_Export (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94ECF: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 26 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F7B93F: Tcl_GetThreadData (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F9DFEF: TclpGetPwUid (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F9D487: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E950BF: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 27 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E8F8B1: Tcl_CreateObjCommand (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94562: Tcl_NRCreateCommand (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15DDB: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4FB0707: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4FA0C31: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E95117: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 28 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F586B6: Tcl_CreateNamespace (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F9FC78: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4FA2AD7: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4FADEF1: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4FA0C39: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E95117: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 16,384 bytes in 1 blocks are possibly lost in loss record 29 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E998FB: Tcl_Alloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F732E7: Tcl_NewStringObj (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F626BC: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E92976: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E93206: Tcl_EvalEx (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E93228: Tcl_Eval (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4FA0C7E: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E95117: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 32,768 bytes in 2 blocks are possibly lost in loss record 30 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C119: TclpAlloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F7C48E: TclpRealloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E9999B: Tcl_Realloc (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F85E5E: Tcl_DStringSetLength (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F12EC0: Tcl_ExternalToUtfDString (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F18DC5: TclSetupEnv (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E94FBB: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 38,400 bytes in 1 blocks are possibly lost in loss record 31 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C653: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F5CD1C: Tcl_NewObj (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E945D1: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== 38,400 bytes in 1 blocks are possibly lost in loss record 32 of 32
==2365686== at 0x4C39185: malloc (vg_replace_malloc.c:442)
==2365686== by 0x4F7C653: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4F15E05: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4FB06F1: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4FA0C31: ??? (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4E95117: Tcl_CreateInterp (in /usr/lib64/libtcl8.6.so)
==2365686== by 0x4006A9: main (main2.cpp:6)
==2365686==
==2365686== LEAK SUMMARY:
==2365686== definitely lost: 0 bytes in 0 blocks
==2365686== indirectly lost: 0 bytes in 0 blocks
==2365686== possibly lost: 388,096 bytes in 21 blocks
==2365686== still reachable: 66,948 bytes in 20 blocks
==2365686== suppressed: 0 bytes in 0 blocks
==2365686== Reachable blocks (those to which a pointer was found) are not shown.
==2365686== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2365686==
==2365686== ERROR SUMMARY: 20 errors from 20 contexts (suppressed: 0 from 0)
int main() { Tcl_Interp* interp = Tcl_CreateInterp(); Tcl_DeleteInterp(interp); }-- You should start with only those two lines to see if this causes leaks. Then add lines until you see the leak messages. Also, I advise using RAII for things like this. What would happen if in a larger program, an exception thrown, and theTcl_DeleteInterp(interp)is never executed?PURIFYflag is for compiling Tcl, not your application. If you wish to find actual memory leaks in the interpreter, you should compile it withTCL_MEM_DEBUGset as well.