{"id":4386,"date":"2023-11-24T11:58:54","date_gmt":"2023-11-24T11:58:54","guid":{"rendered":"https:\/\/ibex.tech\/python\/?p=4386"},"modified":"2023-11-24T11:58:55","modified_gmt":"2023-11-24T11:58:55","slug":"malloc","status":"publish","type":"post","link":"https:\/\/ibex.tech\/python\/memory-python\/malloc","title":{"rendered":"malloc"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Temporary memory example<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\t\/\/CREATE TEMPORARY MEMORY BUFFER\n\tuint32_t *my_temporary_memory_buffer = malloc(1024 * sizeof(uint32_t));\t\/\/Allocate a block of size bytes of memory, returning a pointer to the beginning of the block.  Use calloc() to do same but zero initialise the buffer.\n\tif (my_temporary_memory_buffer != NULL)\n\t{\n\t\t\n\t\t\/\/Use my_temporary_memory_buffer as needed \n\t\tmy_temporary_memory_buffer&#91;0] = 1234;\n\t\t\n\t\t\/\/RELEASE TEMPORARY MEMORY BUFFER\n\t\tfree(my_temporary_memory_buffer);\t\t\t\t\t\t\t\t\t\/\/Deallocate the block of memory, making it available again for future allocations\n\t}\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Temporary memory example<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[],"class_list":["post-4386","post","type-post","status-publish","format-standard","hentry","category-memory-python"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/comments?post=4386"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4386\/revisions"}],"predecessor-version":[{"id":4387,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/posts\/4386\/revisions\/4387"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/media?parent=4386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/categories?post=4386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/python\/wp-json\/wp\/v2\/tags?post=4386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}