mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user