New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
call k_malloc or k_mem_slab_alloc allowed or not #28020
Comments
These APIs use spinlocks for syncrhonization and should be ISR safe, but the timeout value must be K_NO_WAIT for don't use libc malloc() though ;) |
converting this to a minor documentation issue |
Note that k_mem_pool_alloc() (soon to be deprecated) and k_heap_alloc() both have the same documentation bug. They're safe to call in an interrupt as long as the timeout is K_NO_WAIT |
Added a note in documentation for k_mem_slab_alloc(), k_mem_pool_alloc() and k_heap_alloc() are safe to call in an interrupt with the timeout K_NO_WAIT. Fixes: zephyrproject-rtos#28020 Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
Added a note in documentation for k_mem_slab_alloc(), k_mem_pool_alloc() and k_heap_alloc() are safe to call in an interrupt with the timeout K_NO_WAIT. Fixes: #28020 Signed-off-by: Spoorthy Priya Yerabolu <spoorthy.priya.yerabolu@intel.com>
We are calling k_malloc() and k_mem_slab_alloc() from our timer and uart ISRs and were not experiencing any issues that we knew of. We noticed that the documentation does not say it can't be called from an ISR but it doesn't say we can either (like other kernel APIs do).
Can they be called from an ISR?
Thanks
The text was updated successfully, but these errors were encountered: