Issue seen with rv-virt:knsh64 as well. After first ostest run the memory usage rises by ~500 bytes, but the consequent runs do not increase it further.
Something is allocated once from kheap that is never freed again. nsh> free total used free maxused maxfree nused nfree Kmem: 2063416 11704 2051712 33168 2051040 41 3 Page: 4194304 118784 4075520 4075520 nsh> free total used free maxused maxfree nused nfree Kmem: 2063416 12168 2051248 54320 2040560 46 5 Page: 4194304 118784 4075520 4075520 nsh> free total used free maxused maxfree nused nfree Kmem: 2063416 12168 2051248 54368 2040560 46 5 Page: 4194304 118784 4075520 4075520 nsh> Running some other process does not show this behavior: nsh> free total used free maxused maxfree nused nfree Kmem: 2063416 11704 2051712 33168 2051040 41 3 Page: 4194304 118784 4075520 4075520 nsh> getprime Set thread priority to 10 Set thread policy to SCHED_RR Start thread #0 thread #0 started, looking for primes < 10000, doing 10 run(s) thread #0 finished, found 1230 primes, last one was 9973 Done getprime took 118 msec nsh> free total used free maxused maxfree nused nfree Kmem: 2063416 11704 2051712 37152 2051040 41 3 Page: 4194304 118784 4075520 4075520 nsh> -Ville ________________________________ From: yfliu2008 <yfliu2...@qq.com.INVALID> Sent: Friday, October 4, 2024 4:07 AM To: dev <dev@nuttx.apache.org> Subject: Re:[VOTE] Apache NuttX 12.7.0 RC0 release +1 for CanMV230 device. Checked with Canmv230 on Oct 4th, 2024 from Ubuntu 23.04 desktop. In general is works, with minor issues: - Two kernel mode configs `nsbi` and `knsh` both show used memory growth after ostest. - The protected mode `pnsh` facing tight stack for NSH app, thus lead to weird free memory status. After tweaking kconfig with a larger stack size config, it looks fine. Given the fact that no real k230 project is known, I am ok to go ahead with this RC. ### toolchain Toolchain name: `gcc-riscv64-unknown-elf 10.2.0-0ubuntu1` on Ubuntu 22.04 ```shell $ riscv64-unknown-elf-gcc -v Using built-in specs. Target: riscv64-unknown-elf Thread model: single Supported LTO compression algorithms: zlib gcc version 10.2.0 () ``` ### nsh ``` ## Starting application at 0x06000000 ... ABC NuttShell (NSH) NuttX-12.7.0 nsh> cat /proc/version NuttX version 12.7.0 10e44f8915 Oct 4 2024 08:20:24 canmv230:nsh nsh> free total used free maxused maxfree nused nfree Umem: 16585336 8024 16577312 8704 16577312 22 1 nsh> ps PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND 0 0 0 FIFO Kthread - Ready 0000000000000000 002032000816 40.1% Idle_Task 1 1 100 RR Task - Running 0000000000000000 003024002304 76.1% nsh_main nsh> ostest >/dev/null; rm -r /var; free stdio_test: write fd=2 stdio_test: Standard I/O Check: fprintf to stderr setvbuf_test: Using NO buffering setvbuf_test: Using default FULL buffering setvbuf_test: Using FULL buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer setvbuf_test: Using LINE buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer total used free maxused maxfree nused nfree Umem: 16585336 8024 16577312 51024 16577312 22 1 nsh> ``` ### pnsh ``` Bytes transferred = 366196 (59674 hex) ## Starting application at 0x06000000 ... ABC NuttShell (NSH) NuttX-12.7.0 nsh> cat /proc/version NuttX version 12.7.0 10e44f8915 Oct 4 2024 08:35:24 canmv230:pnsh nsh> ps PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND 0 0 0 FIFO Kthread - Ready 0000000000000000 002032 000816 40.1% Idle_Task 1 1 100 RR Task - Running 0000000000000000 003024 002800 92.5%! nsh_main nsh> free total used free maxused maxfree nused nfree Kmem: 1034232 3448 1030784 4288 1030784 17 1 Umem: 1045080 6040 1039040 6752 1039040 9 1 nsh> ostest >/dev/null; rm -r /var; free stdio_test: write fd=2 stdio_test: Standard I/O Check: fprintf to stderr setvbuf_test: Using NO buffering setvbuf_test: Using default FULL buffering setvbuf_test: Using FULL buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer setvbuf_test: Using LINE buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer total used free maxused maxfree nused nfree Kmem: 1034232 3448 1030784 12416 1030784 17 1 Umem: 1045080 1512 1532345888 45328 1431655764 4 2 ``` After enlarging NSH stack size, it looks fine: ``` Bytes transferred = 366204 (5967c hex) ## Starting application at 0x06000000 ... ABC NuttShell (NSH) NuttX-12.7.0 nsh> ps PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND 0 0 0 FIFO Kthread - Ready 0000000000000000 002032 000816 40.1% Idle_Task 1 1 100 RR Task - Running 0000000000000000 004048 002800 69.1% nsh_main nsh> free total used free maxused maxfree nused nfree Kmem: 1034232 3448 1030784 4288 1030784 17 1 Umem: 1045080 7064 1038016 7744 1038016 9 1 nsh> ostest >/dev/null; rm -r /var; free stdio_test: write fd=2 stdio_test: Standard I/O Check: fprintf to stderr setvbuf_test: Using NO buffering setvbuf_test: Using default FULL buffering setvbuf_test: Using FULL buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer setvbuf_test: Using LINE buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer total used free maxused maxfree nused nfree Kmem: 1034232 3448 1030784 12416 1030784 17 1 Umem: 1045080 7064 1038016 46352 1025792 9 2 nsh> ``` ### nsbi ``` Bytes transferred = 525064 (80308 hex) ## Starting application at 0x06000000 ... BC NuttShell (NSH) NuttX-12.7.0 nsh> cat /proc/version NuttX version 12.7.0 10e44f8915 Oct 4 2024 08:41:16 canmv230:nsbi nsh> ps PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND 0 0 0 FIFO Kthread - Ready 0000000000000000 003056 000720 23.5% Idle_Task 1 0 100 RR Kthread - Waiting Semaphore 0000000000000000 001968 000720 36.5% lpwork 0x6080008 0x6080050 3 3 100 RR Task - Running 0000000000000000 003008 001352 44.9% /system/bin/init nsh> free total used free maxused maxfree nused nfree Kmem: 1528824 10440 1518384 24704 1517712 34 4 Page: 14680064 606208 14073856 14073856 nsh> ostest >/dev/null ; rm -r /var; free stdio_test: write fd=2 stdio_test: Standard I/O Check: fprintf to stderr setvbuf_test: Using NO buffering setvbuf_test: Using default FULL buffering setvbuf_test: Using FULL buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer setvbuf_test: Using LINE buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer total used free maxused maxfree nused nfree Kmem: 1528824 10584 1518240 51232 1517712 35 5 Page: 14680064 1228800 13451264 13451264 nsh> ``` ### knsh ``` Bytes transferred = 3146472 (3002e8 hex) ## Starting application at 0x06000000 ... OpenSBI v0.9 ____ _____ ____ _____ / __ \ / ____| _ \_ _| | | | |_ __ ___ _ __ | (___ | |_) || | | | | | '_ \ / _ \ '_ \ \___ \| _ < | | | |__| | |_) | __/ | | |____) | |_) || |_ \____/| .__/ \___|_| |_|_____/|____/_____| | | |_| Platform Name : T-HEAD c908 Platform Features : mfdeleg Platform HART Count : 1 Platform IPI Device : clint Platform Timer Device : clint Platform Console Device : uart8250 Platform HSM Device : --- Platform SysReset Device : --- Firmware Base : 0x8000000 Firmware Size : 108 KB Runtime SBI Version : 0.3 Domain0 Name : root Domain0 Boot HART : 0 Domain0 HARTs : 0* Domain0 Region00 : 0x0000000f04000000-0x0000000f0400ffff (I) Domain0 Region01 : 0x0000000008000000-0x000000000801ffff () Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X) Domain0 Next Address : 0x0000000008200000 Domain0 Next Arg1 : 0x000000000a000000 Domain0 Next Mode : S-mode Domain0 SysReset : yes Boot HART ID : 0 Boot HART Domain : root Boot HART ISA : rv64imafdcbsux Boot HART Features : scounteren,mcounteren,time Boot HART PMP Count : 64 Boot HART PMP Granularity : 4 Boot HART PMP Address Bits: 30 Boot HART MHPM Count : 16 Boot HART MHPM Count : 16 Boot HART MIDELEG : 0x0000000000000222 Boot HART MEDELEG : 0x000000000000b109 ABC NuttShell (NSH) NuttX-12.7.0 nsh> cat /proc/version NuttX version 12.7.0 10e44f8915 Oct 4 2024 08:45:51 canmv230:knsh nsh> ps PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND 0 0 0 FIFO Kthread - Ready 0000000000000000 003056 000720 23.5% Idle_Task 1 0 100 RR Kthread - Waiting Semaphore 0000000000000000 001968 000720 36.5% lpwork 0x8300000 0x8300048 3 3 100 RR Task - Running 0000000000000000 003008 001352 44.9% /system/bin/init nsh> free total used free maxused maxfree nused nfree Kmem: 1008632 10312 998320 24576 994272 34 4 Page: 10485760 606208 9879552 9879552 nsh> ostest >/dev/null ; rm -r /var ; free stdio_test: write fd=2 stdio_test: Standard I/O Check: fprintf to stderr setvbuf_test: Using NO buffering setvbuf_test: Using default FULL buffering setvbuf_test: Using FULL buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer setvbuf_test: Using LINE buffering, buffer size 64 setvbuf_test: Using FULL buffering, pre-allocated buffer total used free maxused maxfree nused nfree Kmem: 1008632 10456 998176 51168 994272 35 5 Page: 10485760 1228800 9256960 9256960 nsh> ``` Original From:"Alin Jerpelea"< jerpe...@gmail.com >; Date:2024/10/3 16:35 To:"dev"< dev@nuttx.apache.org >; Subject:[VOTE] Apache NuttX 12.7.0 RC0 release Hello all, Apache NuttX 12.7.0 RC0 has been staged under [1] and it's time to vote on accepting it for release. Voting will be open for 72hr. A minimum of 3 binding +1 votes and more binding +1 than binding -1 are required to pass. The Apache requirements for approving a release can be found here [3] "Before voting +1 PMC members are required to download the signed source code package, compile it as provided, and test the resulting executable on their own platform, along with also verifying that the package meets the requirements of the ASF policy on releases." A document to walk through some of this process has been published on our project wiki and can be found here [4]. [ ] +1 accept (indicate what you validated - e.g. performed the non-RM items in [4]) [ ] -1 reject (explanation required) Thank you all, Alin Jerpelea SCM Information: Release tag: nuttx-12.7.0-RC0 Hash for the release nuttx tag: 10e44f8915a4e4dc016f117bc75973750c7e3edf Hash for the release nuttx-apps tag: ac11e3cba9a1c9db02e0b9072e89e9113d4e776d [1] https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdist.apache.org%2Frepos%2Fdist%2Fdev%2Fnuttx%2F12.7.0-RC0%2F&data=05%7C02%7Cville.juven%40unikie.com%7C9d25f0b22cf2439dc16e08dce41191f1%7C9207ba3377314e38abf1c7183f53f8c3%7C0%7C0%7C638636011338286721%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=BQCa2iXZvBsmiurVs2aAqiuJCRM5C6pTAvrsKCGnnq8%3D&reserved=0<https://dist.apache.org/repos/dist/dev/nuttx/12.7.0-RC0/> [2] https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fapache%2Fnuttx%2Fnuttx-12.7.0-RC0%2FReleaseNotes&data=05%7C02%7Cville.juven%40unikie.com%7C9d25f0b22cf2439dc16e08dce41191f1%7C9207ba3377314e38abf1c7183f53f8c3%7C0%7C0%7C638636011338307489%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=itVrq47YkY9Mq2IQswvdHkC8T1Yt3YS9uBHfFZCKdiQ%3D&reserved=0<https://raw.githubusercontent.com/apache/nuttx/nuttx-12.7.0-RC0/ReleaseNotes> [3] https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.apache.org%2Fdev%2Frelease.html%23approving-a-release&data=05%7C02%7Cville.juven%40unikie.com%7C9d25f0b22cf2439dc16e08dce41191f1%7C9207ba3377314e38abf1c7183f53f8c3%7C0%7C0%7C638636011338318701%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=yhcV7QkD7Wcw1akoqnxn8Eni7dr0B7DPDfEVSQFH1I8%3D&reserved=0<https://www.apache.org/dev/release.html#approving-a-release> [4] https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FNUTTX%2FValidating%2Ba%2Bstaged%2BRelease&data=05%7C02%7Cville.juven%40unikie.com%7C9d25f0b22cf2439dc16e08dce41191f1%7C9207ba3377314e38abf1c7183f53f8c3%7C0%7C0%7C638636011338329126%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=we8z0s7Bn5HH2jvHck1NQOmbuA2pPK1eTuBbP0XQ%2Fws%3D&reserved=0<https://cwiki.apache.org/confluence/display/NUTTX/Validating+a+staged+Release>