I have an interface class Sensor with a virtual read(), and derived classes such as Bme280 that own a buffer allocated in the constructor. Objects are created with Sensor *s = new Bme280; and later destroyed with delete s;. A static analyser warns that Sensor has virtual functions but a non-virtual destructor, and a heap trace shows the derived buffer is never freed.
Why does delete not call the derived destructor here, and is adding virtual expensive on a microcontroller with 32 KB of flash?




