ChibiOS Memory Allocators with C++ Standard Library
Posted: Sun Dec 28, 2014 6:51 pm
Hi everyone,
I'm developing a system that is using C++ with the standard library linked and ChibiOS. My toolchain is yagarto with newlib and the g++ compiler. I've overridden the new and delete operators to use chHeapAlloc/chHeapFree but obviously these are not used in the C++ standard library. It is my understanding that it relies on malloc in the C library. Is it okay to let the standard library use malloc? Will allocating containers like std::vector be thread safe despite not using the ChibiOS memory allocators? If not, how can I force the standard library to use the ChibiOS allocators or at least make malloc thread safe?
Thanks!
I'm developing a system that is using C++ with the standard library linked and ChibiOS. My toolchain is yagarto with newlib and the g++ compiler. I've overridden the new and delete operators to use chHeapAlloc/chHeapFree but obviously these are not used in the C++ standard library. It is my understanding that it relies on malloc in the C library. Is it okay to let the standard library use malloc? Will allocating containers like std::vector be thread safe despite not using the ChibiOS memory allocators? If not, how can I force the standard library to use the ChibiOS allocators or at least make malloc thread safe?
Thanks!