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

See Also

Tcl_NewObj, Tcl_NewStringObj, ...


official reference: C API


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

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?