forked from Archive/PX4-Autopilot
Increase stack space on posix 64bit architectures. (#5447)
When running a simulation with, for example, make posix jmavsim px4 crashed almost 100% reproducable near start up. This turned out to be a stack overflow. On gitter it was suggested that the main reason for this could be stack sizes, as currently used, assume a 32bit pointer size and that doubling the stack size for everything but NuttX would be the Right Thing. This is the solution that I came up with (it makes my core dumps disappear).
This commit is contained in:
parent
f607069a57
commit
4a5eae23a2
|
@ -185,6 +185,10 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int
|
|||
stack_size = PTHREAD_STACK_MIN;
|
||||
}
|
||||
|
||||
// The stack size is intended for 32-bit architectures; therefore
|
||||
// we often run out of stack space when pointers are larger than 4 bytes.
|
||||
// Double the stack size on posix when we're on a 64-bit architecture.
|
||||
stack_size *= __SIZEOF_POINTER__ >> 2;
|
||||
rv = pthread_attr_setstacksize(&attr, stack_size);
|
||||
|
||||
if (rv != 0) {
|
||||
|
|
Loading…
Reference in New Issue