Re: [hackers] [sbase][PATCH] ls, xargs: Reduce sbase-box static bss memory usage
Hi,
On Wed, Jun 04, 2025 at 03:02:06PM +1000, Xan Phung wrote:
> These two tools use large static buffers. In sbase-box, 146Kb is
> always allocated for them, even if they are not the tool being run.
>
> This patch changes their buffer allocation to use the stack instead
> of static memory. The bss size of sbase-box is reduced from 179Kb
> to 33Kb. Test scripts are provided for regression testing.
Good point. I think storing them in the stack is not a good idea
neither, because so huge arrays should not go to the stack but
to the heap. I think we can change this to static pointers with
lazy initialization (in case they are used in different functions).
I would split the commit changing these variables and the tests,
because having the regression tests make this commit dependant of
the other that you sent (in fact, that was one of the reasons I had
this in the TODO list for a while). I like the idea about creating
the test framework, but I would like to have a discussion about how
it should be. I will continue that discussion in the other patch.
Regards,
Received on Wed Nov 05 2025 - 17:19:19 CET
This archive was generated by hypermail 2.3.0
: Wed Nov 05 2025 - 17:24:36 CET