Closed
Description
memory leak on functional interrupt attachInterrupt()
call.
https://github.com/esp8266/Arduino/blob/master/cores/esp8266/FunctionalInterrupt.cpp#L20
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode)
{
// use the local interrupt routine which takes the ArgStructure as argument
__attachInterruptArg (pin, (voidFuncPtr)interruptFunctional, new ArgStructure{intRoutine}, mode);
}
Every time you call attachInterrupt()
a new ArgStructure gets created and doesn't get destroyed.
When I create a (global) ArgStructure and just change the std::function inside the struct (hence reusing the ArgStructure), the memory leak disappears. Obviously, this isn't a valid solution.