mp-se / kegmon

DIY scale for beer keg monitoring
MIT License
10 stars 4 forks source link

TempSensorBase has no virtual destructor, causing memory leak of no temperature sensor connected #29

Closed caswal closed 8 months ago

caswal commented 10 months ago

Thanks for KegMon is a great project, I have been modifying to add support for 3 and 4 Scales.

temp_base.hpp is missing a virtual destructor, therefore TempSensorDS and TempSensorDHT are not getting their destructors called on the std::unique_ptr reset in TempSensorManager::setup() This causes about a 100-byte memory leak for TempSensorDS per attempted setup cycle if no temperature sensor is connected.

My work in progress fork with my 3/4 scales changes are here: https://github.com/caswal/kegmon/tree/4_Scale

In short, I added a scale_count = x to [common_env_data] in platform.io

This enables various #if CFG_SCALECOUNT > 2 etc macros to enable more scale logic. It also uses scale_count with a python script to then move different htm files from the sub 2/3/4 folders to /html and minimize them.

I don't have any displays yet, so haven't done anything in regards to that, annoyingly on my custom PCB's, the community OLED 0.96" Component I used, had the VCC and GND Nets swapped on the footprint. So need to get some new ones made.

mp-se commented 10 months ago

Thanks, i will fix that. Good find

mp-se commented 8 months ago

Fixed in dev