Using std::deque inside USBSerial IRQHandler read function

I’m using the the non RTOS version of USBSerial class for a personal project of mine.

My question is that is it safe to use the std::deque library and some of its methods (push_back, pop, etc…) inside the USBSerial IRQHandler read function?

I’ve been running it for a couple days now and everything seems to be OK. But according to a few people, dynamic memory allocation inside IRQ handlers will eventually cause hardfaults down the road, and the deque library from the STL does just that behind the scene.

It is possible to provide your own memory allocator with stl containers.

https://en.cppreference.com/w/cpp/memory/allocator