{"id":7444,"date":"2022-12-20T19:38:07","date_gmt":"2022-12-20T22:38:07","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/tcl_alloc-man3-3\/"},"modified":"2022-12-20T19:38:07","modified_gmt":"2022-12-20T22:38:07","slug":"tcl_alloc-man3-3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/tcl_alloc-man3-3\/","title":{"rendered":"Tcl_Alloc (man3)"},"content":{"rendered":"<h1 align=\"center\">Tcl_Alloc<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#ARGUMENTS\">ARGUMENTS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#KEYWORDS\">KEYWORDS<\/a> <\/p>\n<hr>\n<p>______________________________________________________________________________<\/p>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc, ckalloc, ckfree, ckrealloc, attemptckalloc, attemptckrealloc \u2212 allocate or free heap memory<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <tcl.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> Tcl_Alloc<\/b>(<i>size<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">void <b><br \/> Tcl_Free<\/b>(<i>ptr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> Tcl_Realloc<\/b>(<i>ptr, size<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> Tcl_AttemptAlloc<\/b>(<i>size<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> Tcl_AttemptRealloc<\/b>(<i>ptr, size<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> ckalloc<\/b>(<i>size<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">void <b><br \/> ckfree<\/b>(<i>ptr<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> ckrealloc<\/b>(<i>ptr, size<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> attemptckalloc<\/b>(<i>size<\/i>)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">char bodies manpages.csv script_extrae_body.sh script.sh usr <b><br \/> attemptckrealloc<\/b>(<i>ptr, size<\/i>)<\/p>\n<h2>ARGUMENTS <a name=\"ARGUMENTS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"34%\">\n<p style=\"margin-top: 1em\">unsigned int <i>size<\/i> (in)<\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"51%\">\n<p style=\"margin-top: 1em\">Size in bytes of the memory block to allocate.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"34%\">\n<p>char <i>*ptr<\/i> (in)<\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"51%\">\n<p>Pointer to memory block to free or realloc.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:49%;\">______________________________________________________________________________<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">These procedures provide a platform and compiler independent interface for memory allocation. Programs that need to transfer ownership of memory blocks between Tcl and other modules should use these routines rather than the native <b>malloc()<\/b> and <b>free()<\/b> routines provided by the C run-time library.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_Alloc<\/b> returns a pointer to a block of at least <i>size<\/i> bytes suitably aligned for any use.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_Free<\/b> makes the space referred to by <i>ptr<\/i> available for further allocation.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_Realloc<\/b> changes the size of the block pointed to by <i>ptr<\/i> to <i>size<\/i> bytes and returns a pointer to the new block. The contents will be unchanged up to the lesser of the new and old sizes. The returned location may be different from <i>ptr<\/i>. If <i>ptr<\/i> is NULL, this is equivalent to calling <b>Tcl_Alloc<\/b> with just the <i>size<\/i> argument.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Tcl_AttemptAlloc<\/b> and <b>Tcl_AttemptRealloc<\/b> are identical in function to <b>Tcl_Alloc<\/b> and <b>Tcl_Realloc<\/b>, except that <b>Tcl_AttemptAlloc<\/b> and <b>Tcl_AttemptRealloc<\/b> will not cause the Tcl interpreter to <b>panic<\/b> if the memory allocation fails. If the allocation fails, these functions will return NULL. Note that on some platforms, but not all, attempting to allocate a zero-sized block of memory will also cause these functions to return NULL.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The procedures <b>ckalloc<\/b>, <b>ckfree<\/b>, <b>ckrealloc<\/b>, <b>attemptckalloc<\/b>, and <b>attemptckrealloc<\/b> are implemented as macros. Normally, they are synonyms for the corresponding procedures documented on this page. When Tcl and all modules calling Tcl are compiled with <b>TCL_MEM_DEBUG<\/b> defined, however, these macros are redefined to be special debugging versions of these procedures. To support Tcl\u2019s memory debugging within a module, use the macros rather than direct calls to <b>Tcl_Alloc<\/b>, etc.<\/p>\n<h2>KEYWORDS <a name=\"KEYWORDS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">alloc, allocation, free, malloc, memory, realloc, TCL_MEM_DEBUG<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc, ckalloc, ckfree, ckrealloc, attemptckalloc, attemptckrealloc \u2212 allocate or free heap memory <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,3007,3756],"class_list":["post-7444","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-man3","tag-tcl_free"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7444"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7444\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}