dircache: increase stack size to avoid stack overflows

On FS#13821, a test build with -fstack-protector-all
(which adds 4 bytes of stack to each function, roughly)
overflowed the dircache stack on the Hifiwalker H2.
In my own testing, the dircache thread hit 94% stack
use on the Fiio M3K using the same settings.

That seems a bit too close to the limit, especially
since the dircache uses recursion and might consume
more stack space for deeply nested directories.

Adding 768 bytes should provide enough of a safety
margin. This increases the stack size from 1.25k to
2k on most targets, including all X1000 targets.

Change-Id: I900c19da9fb33f539d02b00830aedeb15c7449e2
This commit is contained in:
Aidan MacDonald 2026-04-21 22:05:51 +01:00
parent d815053360
commit e661c35b29

View file

@ -44,7 +44,7 @@
the limiting factor is the scanning thread stack size, not the the limiting factor is the scanning thread stack size, not the
implementation -- tune the two together */ implementation -- tune the two together */
#define DIRCACHE_MAX_DEPTH 15 #define DIRCACHE_MAX_DEPTH 15
#define DIRCACHE_STACK_SIZE (DEFAULT_STACK_SIZE + 0x100) #define DIRCACHE_STACK_SIZE (DEFAULT_STACK_SIZE + 0x400)
/* memory buffer constants that control allocation */ /* memory buffer constants that control allocation */
#define DIRCACHE_RESERVE (1024*64) /* 64 KB - new entry slack */ #define DIRCACHE_RESERVE (1024*64) /* 64 KB - new entry slack */