MCPcopy Index your code
hub / github.com/RT-Thread/rt-thread / rt_malloc

Function rt_malloc

src/kservice.c:854–868  ·  view source on GitHub ↗

* @brief Allocate a block of memory with a minimum of 'size' bytes. * * @param size is the minimum size of the requested block in bytes. * * @return the pointer to allocated memory or NULL if no free memory was found. */

Source from the content-addressed store, hash-verified

852 * @return the pointer to allocated memory or NULL if no free memory was found.
853 */
854rt_weak void *rt_malloc(rt_size_t size)
855{
856 rt_base_t level;
857 void *ptr;
858
859 /* Enter critical zone */
860 level = _heap_lock();
861 /* allocate memory block from system heap */
862 ptr = _MEM_MALLOC(size);
863 /* Exit critical zone */
864 _heap_unlock(level);
865 /* call 'rt_malloc' hook */
866 RT_OBJECT_HOOK_CALL(rt_malloc_hook, (&ptr, size));
867 return ptr;
868}
869RTM_EXPORT(rt_malloc);
870
871/**

Callers 15

finsh_set_promptFunction · 0.85
msh_exec_scriptFunction · 0.85
cmd_mvFunction · 0.85
directory_delete_for_mshFunction · 0.85
directory_setattrFunction · 0.85
msh_exec_moduleFunction · 0.85
_msh_exec_search_pathFunction · 0.85
msh_auto_complete_pathFunction · 0.85
fal_partition_initFunction · 0.85
fal_blk_device_createFunction · 0.85

Calls 2

_heap_lockFunction · 0.85
_heap_unlockFunction · 0.85

Tested by 15

utest_initFunction · 0.68
uart_tx_demoFunction · 0.68
utest_tc_initFunction · 0.68
ic_rx_threadFunction · 0.68
nand_thread_entryFunction · 0.68
ssd1306_write_mult_regFunction · 0.68
sdmmc_thread_entryFunction · 0.68
udpecho_socket_entryFunction · 0.68
tcpecho_socket_entryFunction · 0.68
dhry_testFunction · 0.68