Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak when reinstatiating sensor object #5

Open
ScruffR opened this issue Sep 11, 2016 · 1 comment
Open

Memory leak when reinstatiating sensor object #5

ScruffR opened this issue Sep 11, 2016 · 1 comment

Comments

@ScruffR
Copy link
Contributor

ScruffR commented Sep 11, 2016

As I found out here, there is a potential memory leak when using multiple instances of that library
https://community.particle.io/t/ds18b20-switching-pins-during-execution/25727/15

This is easily fixed with the intrdocution of a destructor

DS18B20::~DS18B20() {
    delete(ds);
}

And if you're at it, could you also replace these macros, please?

  • digitalWriteFastHigh()
  • digitalWriteFastLow()
  • digitalReadFast()

with the now available functions

  • pinSetFast(_pin)
  • pinResetFast(_pin)
  • pinReadFast(_pin)

One the other hand it might even be better to remove the "private" implementatino of OneWire and just add a note to import that dependency (this will make getting this lib ready for Libraries 2.0 easier too).

@LukeUSMC
Copy link
Owner

Will do and thanks for the input. I need to get into the Lib 2.0 implementation, I spent 2 hours creating gulp tasks to check for updates, extract lib core files and moving them to the appropriate folder for testing. I hope the new lib system can be used more like a package manager like npm, bower, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants