This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TM4C123FH6PM: Heap Corrupted on new/delete in interrupt handler

Part Number: TM4C123FH6PM

Tool/software: TI C/C++ Compiler

Hello!

Due to nature of application I am creating some objects with new operator during ISR (usually it is event objects with some extra data), and sometimes I create and delete objects in main application. As this behavior potentially leads to heap corruption, then interrupt can occur during new/delete processing, I installed simple lock handlers, disabling interrupts during critical section:

static void my_lock()
{
    _disable_IRQ();
}
static void my_unlock()
{
    _enable_IRQ();
}

and then in initialization:

	_register_lock(my_lock);
	_register_unlock(my_unlock);

But now, as I started creating 8-byte data objects attached to events in protocol's interrupt handler and cleaning up these objects in main event dispatcher, by application started causing hardware fault in ::new.

Any suggestions? Thank you!