Version 3 of ckalloc

Updated 2012-10-26 16:39:56 by AMG

ckalloc is what most C-level users of the Tcl C API use to allocate blocks of memory.

This is a C preprocessor macro which usually expands to Tcl_Alloc, but the compile-time flag TCL_MEM_DEBUG can make it expand to a Tcl_DbCkalloc call instead. The purpose of this is to support memory debugging: no change of source files is needed to turn debugging on.

http://www.tcl.tk/man/tcl8.5/TclLib/Alloc.htm

So: If you're new to C, think Tcl_Alloc (the actual function being called), but write ckalloc (the debug-enabled macro) in case you'll sometime in the future need to debug memory allocation in your code.

Question: Is it a problem if some extensions being used are compiled with TCL_MEM_DEBUG and others are compiled without it?

See also: