sched: catch task memory leak

Print all unreleased memory blocks when the task exits

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai
2022-10-28 11:42:13 +08:00
committed by Xiang Xiao
parent 65dc1fe0fc
commit 2c95c04f4e
2 changed files with 20 additions and 0 deletions
+12
View File
@@ -33,6 +33,7 @@
#include <nuttx/sched.h>
#include <nuttx/fs/fs.h>
#include <nuttx/mm/mm.h>
#include "sched/sched.h"
#include "group/group.h"
@@ -505,6 +506,17 @@ void nxtask_exithook(FAR struct tcb_s *tcb, int status, bool nonblocking)
nxsig_cleanup(tcb); /* Deallocate Signal lists */
#ifdef CONFIG_SCHED_DUMP_LEAK
if ((tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
{
kmm_memdump(tcb->pid);
}
else
{
umm_memdump(tcb->pid);
}
#endif
#ifdef CONFIG_SMP
leave_critical_section(flags);
#endif