The platform specific implementations of setjmp/longjmp use a stack of 10 jump buffers (jmp_buf):
static jmp_buf test_exit_jmp_buf[10];
The size of jmp_buf is considerable, depending on the exact platform (e.g. around 256 bytes or more). Having 10 jump buffers statically allocated eats kilobytes of memory, which may be a big part of the whole test application on embedded devices.
The stack of 10 jump buffers is needed to be able to make nested setjmp/longjmp calls. However, as far as I see, a stack size of 2 would be sufficient (needed in UTest::run).
Suggestions to reduce RAM usage:
- The array size of
jmp_buf can be safely reduced to 2 on all platforms.
- If exceptions are used, the array of
jmp_buf is still allocated and setjmp/longjmp is also used. Please correct me if I'm wrong, but I do not see the point why both exceptions and setjmp/longjmp are used.
The platform specific implementations of
setjmp/longjmpuse a stack of 10 jump buffers (jmp_buf):The size of
jmp_bufis considerable, depending on the exact platform (e.g. around 256 bytes or more). Having 10 jump buffers statically allocated eats kilobytes of memory, which may be a big part of the whole test application on embedded devices.The stack of 10 jump buffers is needed to be able to make nested setjmp/longjmp calls. However, as far as I see, a stack size of 2 would be sufficient (needed in
UTest::run).Suggestions to reduce RAM usage:
jmp_bufcan be safely reduced to 2 on all platforms.jmp_bufis still allocated and setjmp/longjmp is also used. Please correct me if I'm wrong, but I do not see the point why both exceptions and setjmp/longjmp are used.