This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can I reduce the size of jmp_buf?

Hi,

The jmp_buf defined in setjmp.h needs a large buffer, typedef __int64 jmp_buf[48]; //384 bytes

As we checked in function setjmp/longjmp used by Cortex M0/M3, it is used to save only few run-time data such as R0, R1, ...

On some platform which has very limited memory resource, the 384 bytes seems too expensive.
What's the minimal size of jmp_buf?

Thanks!

Parents
  • Since you are considering modifying setjmp/longjmp shipped with the build tools, you might as well implement your own setjmp/longjmp. This way you'll be able to optimize them to the fullest.
    Yes, 384 bytes does seem excessive.
    I don't know what the minimum required size of jmp_buf is, but I think it's safe to assume that it only needs to be big enough to hold the data that setjmp saves.

Reply
  • Since you are considering modifying setjmp/longjmp shipped with the build tools, you might as well implement your own setjmp/longjmp. This way you'll be able to optimize them to the fullest.
    Yes, 384 bytes does seem excessive.
    I don't know what the minimum required size of jmp_buf is, but I think it's safe to assume that it only needs to be big enough to hold the data that setjmp saves.

Children