You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by li...@apache.org on 2024/10/16 10:24:04 UTC
(nuttx-apps) 05/05: nsh/ps: fix -heap cut more than 10MB
This is an automated email from the ASF dual-hosted git repository.
ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 4285c4df73e9fb416aae8deba4dd7c12fe7f97f0
Author: buxiasen <bu...@xiaomi.com>
AuthorDate: Tue Aug 6 22:02:36 2024 +0800
nsh/ps: fix -heap cut more than 10MB
Signed-off-by: buxiasen <bu...@xiaomi.com>
---
nshlib/nsh_proccmds.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/nshlib/nsh_proccmds.c b/nshlib/nsh_proccmds.c
index 84ce4b2b2..8f8da04ed 100644
--- a/nshlib/nsh_proccmds.c
+++ b/nshlib/nsh_proccmds.c
@@ -530,11 +530,11 @@ static int ps_record(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
static void ps_title(FAR struct nsh_vtbl_s *vtbl, bool heap)
{
#ifdef PS_SHOW_HEAPSIZE
- char heapsize[8];
+ char heapsize[16];
if (heap)
{
- sprintf(heapsize, "%7s", "HEAP");
+ snprintf(heapsize, sizeof(heapsize), "%8s", "HEAP");
}
else
{
@@ -591,11 +591,11 @@ static void ps_output(FAR struct nsh_vtbl_s *vtbl, bool heap,
/* Finally, print the status information */
#ifdef PS_SHOW_HEAPSIZE
- char heapsize[8];
+ char heapsize[16];
if (heap)
{
- snprintf(heapsize, sizeof(heapsize), "%07lu", status->td_heapsize);
+ snprintf(heapsize, sizeof(heapsize), "%08lu", status->td_heapsize);
}
else
{