You can use Task(f, n) to create a task with n bytes for the stack size limit. Threads.@spawn does not currently expose this argument, so spawned threads always have a 4 MB stack size (or 2 MB on 32-bit machines), and there is no way to override this.
x-ref #55185 #55184 #54998