summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tcl.h16
-rw-r--r--generic/tclAlloc.c16
-rw-r--r--win/makefile.vc16
3 files changed, 42 insertions, 6 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index a12be09..404c89e 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.31 1999/01/05 01:18:34 rjohnson Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.32 1999/01/06 21:08:50 stanton Exp $
*/
#ifndef _TCL
@@ -71,6 +71,12 @@
# ifndef USE_PROTOTYPE
# define USE_PROTOTYPE 1
# endif
+
+/*
+ * Under Windows we need to call Tcl_Alloc in all cases to avoid competing
+ * C run-time library issues.
+ */
+
# ifndef USE_TCLALLOC
# define USE_TCLALLOC 1
# endif
@@ -743,6 +749,14 @@ EXTERN void Tcl_ValidateAllMemory _ANSI_ARGS_((char *file,
#else
+/*
+ * If USE_TCLALLOC is true, then we need to call Tcl_Alloc instead of
+ * the native malloc/free. The only time USE_TCLALLOC should not be
+ * true is when compiling the Tcl/Tk libraries on Unix systems. In this
+ * case we can safely call the native malloc/free directly as a performance
+ * optimization.
+ */
+
# if USE_TCLALLOC
# define ckalloc(x) Tcl_Alloc(x)
# define ckfree(x) Tcl_Free(x)
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index 7a693ac..6111a7c 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclAlloc.c,v 1.2 1998/09/14 18:39:57 stanton Exp $
+ * RCS: @(#) $Id: tclAlloc.c,v 1.3 1999/01/06 21:08:51 stanton Exp $
*/
#include "tclInt.h"
@@ -125,6 +125,9 @@ char *
TclpAlloc(
unsigned int nbytes) /* Number of bytes to allocate. */
{
+#ifdef USE_NATIVEMALLOC
+ return (char*) malloc(nbytes);
+#else
register union overhead *op;
register long bucket;
register unsigned amt;
@@ -203,6 +206,7 @@ TclpAlloc(
*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
#endif
return ((char *)(op + 1));
+#endif /* USE_NATIVEMALLOC */
}
/*
@@ -279,6 +283,10 @@ void
TclpFree(
char *cp) /* Pointer to memory to free. */
{
+#ifdef USE_NATIVEMALLOC
+ free(cp);
+ return;
+#else
register long size;
register union overhead *op;
@@ -310,6 +318,7 @@ TclpFree(
#ifdef MSTATS
nmalloc[size]--;
#endif
+#endif /* USE_NATIVEMALLOC */
}
/*
@@ -333,6 +342,9 @@ TclpRealloc(
char *cp, /* Pointer to alloced block. */
unsigned int nbytes) /* New size of memory. */
{
+#ifdef USE_NATIVEMALLOC
+ return (char*) realloc(cp, nbytes);
+#else
int i;
union overhead *op;
int expensive;
@@ -407,6 +419,7 @@ TclpRealloc(
*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
#endif
return(cp);
+#endif /* USE_NATIVEMALLOC */
}
/*
@@ -454,3 +467,4 @@ mstats(
MAXMALLOC, nmalloc[NBUCKETS]);
}
#endif
+
diff --git a/win/makefile.vc b/win/makefile.vc
index 9d51847..366e49f 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -4,7 +4,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
-# RCS: @(#) $Id: makefile.vc,v 1.21 1998/11/02 23:04:15 stanton Exp $
+# RCS: @(#) $Id: makefile.vc,v 1.22 1999/01/06 21:08:51 stanton Exp $
# Does not depend on the presence of any environment variables in
# order to compile tcl; all needed information is derived from
@@ -47,12 +47,20 @@ MACHINE = IX86
# Set NODEBUG to 0 to compile with symbols
NODEBUG = 1
-# uncomment one of the following lines to compile with TCL_MEM_DEBUG,
-# TCL_MEM_DEBUG, or TCL_COMPILE_DEBUG
+# The following defines can be used to control the amount of debugging
+# code that is added to the compilation.
+#
+# -DTCL_MEM_DEBUG Enables the debugging memory allocator.
+# -DTCL_COMPILE_DEBUG Enables byte compilation logging.
+# -DTCL_COMPILE_STATS Enables byte compilation statistics gathering.
+# -DUSE_NATIVEMALLOC Disables the Tcl memory allocator in favor
+# of the native malloc implementation. This is
+# needed when using Purify.
+#
#DEBUGDEFINES = -DTCL_MEM_DEBUG
#DEBUGDEFINES = -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG
-#DEBUGDEFINES = -DTCL_MEM_DEBUG -DTCL_COMPILE_STATS
#DEBUGDEFINES = -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
+#DEBUGDEFINES = -DUSE_NATIVEMALLOC
######################################################################
# Do not modify below this line