* @brief This function will release the previously allocated memory block by * rt_malloc. The released memory block is taken back to system heap. * * @param ptr the address of memory which will be released. */
| 931 | * @param ptr the address of memory which will be released. |
| 932 | */ |
| 933 | rt_weak void rt_free(void *ptr) |
| 934 | { |
| 935 | rt_base_t level; |
| 936 | |
| 937 | /* call 'rt_free' hook */ |
| 938 | RT_OBJECT_HOOK_CALL(rt_free_hook, (&ptr)); |
| 939 | /* NULL check */ |
| 940 | if (ptr == RT_NULL) return; |
| 941 | /* Enter critical zone */ |
| 942 | level = _heap_lock(); |
| 943 | _MEM_FREE(ptr); |
| 944 | /* Exit critical zone */ |
| 945 | _heap_unlock(level); |
| 946 | } |
| 947 | RTM_EXPORT(rt_free); |
| 948 | |
| 949 | /** |