This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new ea180792a3d sched/task: fix Redundant memory allocation.
ea180792a3d is described below
commit ea180792a3df683cc5fd2b0c24786d6a11bfb5a1
Author: wangzhi16 <[email protected]>
AuthorDate: Tue Dec 30 19:58:12 2025 +0800
sched/task: fix Redundant memory allocation.
Since the task and group structures are no longer allocated in the same
space, the memory for group is allocated in the group_allocate() function, and
no further allocation is needed during the task allocation process.
Signed-off-by: wangzhi16 <[email protected]>
---
Documentation/guides/kernel_threads_with_custom_stacks.rst | 2 +-
sched/task/task_fork.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/guides/kernel_threads_with_custom_stacks.rst
b/Documentation/guides/kernel_threads_with_custom_stacks.rst
index c180e0200d7..c2f3b48a583 100644
--- a/Documentation/guides/kernel_threads_with_custom_stacks.rst
+++ b/Documentation/guides/kernel_threads_with_custom_stacks.rst
@@ -31,7 +31,7 @@ Here is the body of some function. It expects to have the
following inputs:
* used to that all fields of the new TCB will be zeroed.
*/
- tcb = kmm_zalloc(sizeof(struct tcb_s) + sizeof(struct task_group_s));
+ tcb = kmm_zalloc(sizeof(struct tcb_s));
if (tcb == NULL)
{
return -ENOMEM;
diff --git a/sched/task/task_fork.c b/sched/task/task_fork.c
index d9a79f4d126..59bdf5611bb 100644
--- a/sched/task/task_fork.c
+++ b/sched/task/task_fork.c
@@ -137,7 +137,7 @@ FAR struct tcb_s *nxtask_setup_fork(start_t retaddr)
/* Allocate a TCB for the child task. */
- child = kmm_zalloc(sizeof(struct tcb_s) + sizeof(struct task_group_s));
+ child = kmm_zalloc(sizeof(struct tcb_s));
if (!child)
{
serr("ERROR: Failed to allocate TCB\n");