adafruit / adafruit_shtc3 Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
A memory leak is caused by not deleting the Adafruit_I2CDevice object in the deconstructor.
In begin() line ~66 an Adafruit_I2CDevice object is newed:
i2c_dev = new Adafruit_I2CDevice(SHTC3_DEFAULT_ADDR, theWire);
The deconstructor fails to delete this object.
Adding the following in the deconstructor prevents the memory leak:
if (i2c_dev) { delete i2c_dev; // remove old interface }
The issue affects programs that call the library in a local method and the class goes out of scope in a looping fashion.
To reproduce the issue, just compile a sketch which uses this library. Maybe it is required to add -Wall -Wextra
, the specific compiler flag seems to be -Wunused-function
.
Just opened this issue to let you know about the following compiler warning message:
~/Arduino/libraries/Adafruit_SHTC3/Adafruit_SHTC3.h:51:16: warning: 'uint8_t crc8(const uint8_t*, int)' declared 'static' but never defined [-Wunused-function]
static uint8_t crc8(const uint8_t *data, int len);
Actually, GCC is quite permissive in this case, since we are declaring a crc8()
method inside each translation unit, with internal linkage, but then we do not provide its implementation (so this is not what is expected).
There are two possible fixes:
crc8()
method is "private" to the lib, just remove its declaration from the header.static
from both the header and the implementation.Regards.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.