From 0df5f6d0731024da457eeb42cb88725d93572920 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 11 Aug 2020 16:50:26 -0400 Subject: [PATCH] Provisionally switched the memory allocation definitions away from Tcl_Alloc() and Tcl_Free() because Tcl_Alloc() uses (unsigned int) for the argument type and therefore limits memory allocations to what can fit in 32 bits. Using the system malloc(size_t) should not cause any issues. --- VERSION | 2 +- utils/malloc.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index a7af17d8..e6246dae 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.49 +8.3.50 diff --git a/utils/malloc.c b/utils/malloc.c index 965d6893..7bc17d60 100644 --- a/utils/malloc.c +++ b/utils/malloc.c @@ -74,8 +74,16 @@ static char *freeDelayedItem = NULL; #define MallocRoutine(a) ckalloc(a) #define FreeRoutine(a) ckfree(a) #else -#define MallocRoutine(a) Tcl_Alloc(a) -#define FreeRoutine(a) Tcl_Free(a) +/* DO NOT USE: Tcl_Alloc is defined with argument (unsigned int) NOT + * (size_t) and therefore limits memory allocation to the size of a + * 32-bit integer. Just use the normal malloc() and free(). Left as-is + * with TCL_MEM_DEBUG with the caveat that one should not use this to + * debug a huge design. Valgrind works better anyway. + */ +/* #define MallocRoutine(a) Tcl_Alloc(a) */ +/* #define FreeRoutine(a) Tcl_Free(a) */ +#define MallocRoutine(a) malloc(a) +#define FreeRoutine(a) free(a) #endif #else #define MallocRoutine(a) malloc(a)