Skip to content

Add class destructors and free dynamically allocated objects - #83

Open
fabik111 wants to merge 1 commit into
arduino-libraries:mainfrom
fabik111:fixes-for-dynamic-allocation
Open

fabik111 wants to merge 1 commit into
arduino-libraries:mainfrom
fabik111:fixes-for-dynamic-allocation

Conversation

@fabik111

Copy link
Copy Markdown

Scope

This PR aims to make the Modulini's classes compatible with dynamic allocation.

Issue

The current implementation of some Modulini (ex. Thermo, Movements, Light, Pressure) dynamically allocates some drivers. This dynamically allocated objects can't be released since their classes don't have a proper destructor, causing memory leaks.

Changes

  • add a destructor for each Modulino class which uses dynamic allocation
  • refactor the ModulinoHub to avoid multiple ModulinoHubPorts object on the same port (saving memory) and to avoid delegating the user to handle the ModulinoHubPort pointer

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

Successfully merging this pull request may close these issues.

1 participant